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.
Related
I have one library project in which i have implemented volley library.
api 'com.android.volley:volley:1.1.0'
So i can use same library in main application.
But when i try to use in main application and try to build apk then issue is that Program type already present: com.android.volley.BuildConfig
But if i exclude volley from library project and comment classes that using volley, doing below line then i am able to build apk.
exclude group: "com.android.volley"
So how i can resolve this issue?
Try to remove the library from the module and from the project as well and try to implement volley
implementation 'com.android.volley:volley:1.0.0' on build.gradle of both module and project file.
That error generally means you have two dependencies that are both providing the same class, causing a conflict.There could be two copies of Volley
Like:
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.android.volley:volley:1.1.0'
You can only use one of these or the other. Make sure your dependencies only pull in one copy of the library.
(Note this not my own answer but found it on
https://github.com/google/volley/issues/239 which helped me fixing the issue)
How would I translate those to implementation or api?
Fx. what should I replace those with?
compile project(':jabraServiceApi')
compile files('libs/samsung-digital-health-healthdata-1.2.1.jar')
Maybe compile project and compile files are still supported and should stay as they are?
Gradle 3.4 introduced new Java Library plugin configurations configurations that allow you to control whether a dependency is published to the compile and runtime classpaths of projects that consume that library. The Android plugin is adopting these new dependency configurations, and migrating large projects to use them can drastically reduce build times. The following table helps you understand which configurations you should use.
I already give the answer here please check compile configuration is now deprecated .
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.
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
I am trying to create .aar file from Android Studio. The code I have written needs appcomapt v7 library. I don't want to add the dependency in the build.gradle file of my aar package but want it to take from the project it is added. Please suggest how to do it ?
Thanks.
You need to add it to your library module to use all the classes that Android needs, if your library doesn't use any of those classes, then you can make a jar library.
Now, when you compile your library in the app module, you can exclude the library dependency adding this to the compile line
compile('com.yourpage:yourlibrary:1.0.0'){
exclude module: 'appcompat-v7'
}
I don't want to add the dependency in the build.gradle file of my aar package
You have to include it there, otherwise you can not compile your aar
but want it to take from the project it is added
You can still do that:
If your library declares appcompat-v7 version 23 and your app does not declare appcompat-v7, version 23 will be used in your app.
If your library declares appcompat-v7 version 23 and your app declares appcompat-v7 version 24, version 24 will be used in your app.