I get a lot of these warnings when building my project with gradle. I see https://stackoverflow.com/a/15794650/864069, but I'm unclear how to silence these. It sounds like any version of these things I'm depending on is getting stripped out in favor of the version packaged in android.jar.
I suppose that's okay, but I really would like to shut these up so that the things I see are real problems only.
So, specifically, I'm curious:
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for robolectric as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for robolectric as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.3 is ignored for debugTest as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages
To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build. gradle file. This declares a dependency on an Android library module named "mylibrary" (this name must match the library name defined with an include: in your settings.
Dependency injection (DI) is a technique widely used in programming and well suited to Android development. By following the principles of DI, you lay the groundwork for good app architecture. Implementing dependency injection provides you with the following advantages: Reusability of code. Ease of refactoring.
A dynamic version can be either a version range (e.g. 2. + ) or it can be a placeholder for the latest version available e.g. latest. integration . Alternatively, the module you request can change over time even for the same version, a so-called changing version.
I'm unsure if this can create issues. The best thing to do is to follow the suggestion in the warning, or exclude the dependency entirely (your point #2, which I've answered below).
I've been seeing these warnings as well, specifically the 'commons-logging' one.
What the answer in the thread you linked too is saying is that you should ignore these dependencies since the Android APIs include them already (I think. Correct me if I'm wrong).
For example if you are specifically requiring commons-logging (or another that gives a similar warning) remove it from your list.
build.gradle file:
dependencies { ... compile 'commons-logging:commons-logging:1.1.3' #Remove this line; you don't need it. .... }
Also, if you have a dependency that requires commons-logging as a transitive dependency, you should exclude it as well.
Example:
dependencies { ... compile 'some.package.that:requires_commons_logging:1.2.3' .... }
becomes
dependencies { ... compile ('some.package.that:requires_commons_logging:1.2.3') { exclude group: 'commons-logging', module: 'commons-logging' } .... }
An easy way to completely exclude it can be done by adding this to your build.gradle file as well, without having to exclude it in each dependency:
configurations { all*.exclude group: 'commons-logging', module: 'commons-logging' }
Finally, to view the dependency tree (and to see what each of your dependencies transitively import on their own which can conflict, which can be very useful), use this command from the root of your project:
./gradlew :your_module_name:dependencies
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With