How to find out which library includes which support library version - android

I get following warning:
All com.android.support libraries must use the exact same version specification...
I know what that means, but now I'm stuck on how to easily find out which dependency does include the conflicting versions. I want to exclude the support library from them like following:
compile ('...') {
exclude group: 'android.support'
}
But how do I identify the dependencies that are responsible?

You can watch full gradle dependency tree tree using the command below-
gradle app:dependencies
Reference

Related

Error: Program type already present when building project

I'm using an 'aar' library which I created.
In both, my project and the library, there is a dependency implementation of Conceal library (each from its own lib folder).
When I build the project after importing the library and using ProGuard obfuscation, I get this error message:
Error: Program type already present: com.facebook.crypto.cipher.NativeGCMCipher
How can I resolve this problem?
this error say you are importing the dependency which already imported in project.
solution :- remove or exclude this dependency
ex:-
compile ('com.github.ganfra:material-spinner:1.1.1'){
exclude group: 'com.nineoldandroids'
}
according to mavenCentral(), this is the package name (which could be used instead of .jar):
// https://mvnrepository.com/artifact/com.facebook.conceal/conceal
implementation "com.facebook.conceal:conceal:2.0.2"
therefore the exclusion should look about like this:
implementation( project(":libraryproject") ) {
exclude group: "com.facebook.conceal"
}
To my understanding, the error means that I imported a dependency that already imported in the project (once in the project and once in the library).
The suggested solutions of #Mayur Dabhi and #Martin Zeitler had the right approach, but unfortunately, I wasn't able to get the exclude command working.
finally, with the help of #Martin Zeitler, I replaced:
implementation files('libs/conceal_android.jar')
implementation files('libs/libconceal.jar')
with:
implementation "com.facebook.conceal:conceal:2.0.2"
meaning I removed the 'Conceal' jar files from the 'lib' folder and imported the dependency. After that, the error message disappeared and I managed to build the project.
Thanks for anyone who tried to help :)

Grade sync failing after adding a library

This is the library I am using: https://github.com/ArthurHub/Android-Image-Cropper
The grade sync fails after adding it. Before that, there is no problem.
Apparently, the library you are using uses an older version of the support library v25.3.1, and it is conflicting with the one you have.
Try the following:
compile ('com.theartofdev.edmodo:android-image-cropper:2.4.+') {
exclude group: 'com.android.support'
}
However there are no guarantees that the library would work considering a different version.

What does the ":" mean in gradle android dependency package name?

For example if I depend on the Android Support Library, I add this line in the build.gradle:
dependencies {
...
compile "com.android.support:support-core-utils:24.2.0"
}
My questions are:
Where does the "support-core-utils" and version code is defined in
the support library?
What's the benefit of specifying the lib name and version
code?
The : is a separator used in the shortcut definition of an external library.
dependencies {
...
compile "com.android.support:support-core-utils:24.2.0"
}
stands for
dependencies {
...
compile group: 'com.android.support', name: 'support-core-utils', version: '24.2.0'
}
Here is some documentation.
About the Support library, you can read the support library features list in order to know which part of the support library to add to your project (instead of adding everything and ending with a huge APK :) )
To my mind, the benefit of specifying the version code, is to allow a developer to only update to the last version of a library, when he is sure that his code is compliant with the last changes in this library.
What does the “:” mean in gradle android dependency package name?
Where does the "support-core-utils" and version code is defined in the support library?
: is a separator to enable you to declare a maven dependency group ID, artifact ID and version in a concise way. All three are required to identify a dependency in a maven repository.
Android SDK manager installs a local maven repository ("Android Support Repository") where the actual versions of the support libraries are found.
What's the benefit of specifying the lib name and version code?
The build tooling can find your dependencies and successfully build code that depend on such libraries.

How import android design support library with custom appcompat-v7?

I use Android Studio for my project.
I want to use custom appcompat-v7 library in my android project.
Android design support library has it own appcompat-v7 library.
my gradle
compile(':mycustomAppcompat-v7')
compile 'com.android.support:design:23.2.0'
My problem:
I have two appcompat-v7 library that come from:
1-My custom library.
2-Design support needed.
how can i fix it?
thank you
You can exclude specific modules from libraries you compile with gradle. This feature is valuable in a number of specific situations, like when you have conflicting or duplicated modules as in your case. To fix this, you can explicitly determine which modules you would like to exclude from compilation in gradle as follows:
compile('com.android.support:design:23.2.0'){
exclude module: 'appcompat-v7'
}
This says you want to compile com.android.support:design:23.2.0 but you want to exclude its appcompat-v7 module since you are utilizing your custom one.

Gradle duplicate dependency in library and project

We are working on an application (APP) that uses a local maven dependency library (LIB). LIB uses a custom .jar of OkHttp, and APP also uses OkHttp (not custom). When we try to build, we get a 'Multiple dex files define X' error, and enabling multiDex gives an error about a duplicate ZipException. APP is trying to refer to the OkHttp.jar in LIB, when we want it to not do that. And, well, we can't get it to work.
We've tried placing this in our APP gradle file with no luck:
compile(LIB) {
exclude group: 'com.squareup', module: 'okhttp';
}
And, unfortunately, we can't not use LIB. Thoughts? Also, gradle -q dependencies does not list any dependencies under LIB, but we know that it uses a compile file('CUSTOM_OKHTTP') line in its gradle.

Categories

Resources