I´m using multiple Calendar libraries for a demo aplication for android.
Including Flexible Calendar and Caldroid, both uses Infinite View Pager library, and it gives me Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug' because f the duplicated class files:
java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/antonyt/infiniteviewpager/InfinitePagerAdapter;
So I enabled multidex and I was trying to exlude that library from one of those libraries but I can´t get the expected result.
I tried:
compile ('com.p_v:flexiblecalendar:1.2.1'){
exclude group: 'com.antonyt.infiniteviewpager', module: 'library'
}
and this
compile ('com.p_v:flexiblecalendar:1.2.1'){
exclude group: 'com.antonyt.infiniteviewpager'
}
and this
compile ('com.p_v:flexiblecalendar:1.2.1'){
exclude group: 'antonyt.infiniteviewpager'
}
But it doesn´t work. Im still getting the MultiDex error
Which one is the right way to acomplish this?
It can't work since these libs don't have the module com.antonyt.infiniteviewpager inside.
You can check the dependencies in the build.gradle of each library.
Also you can find the source of the InfinitePagerAdapter in each library (check link1 and link2).
Since the libraries seems to be not updated and quite easy to build you can download one of these as a local module in your project avoiding the duplicate.
Related
I have used 2 third party aar dependencies in my Android Project and
they both are using same Encoding Library called org.spongycastle.util.
But problem here is when i compiled it it shows an Error on Gradle
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException:java.util.zip.ZipException: duplicate entry: org/spongycastle/util/encoders/Base64.class
I tried to exclude one dependency from aar on Gradle complie by
compile(name: 'libraryname', ext: 'aar') {
exclude group: 'org.spongycastle.util'
}
But no luck of solving issue :(
Any help would be appreciated to exclude or ignore one dependency
It looks like the jar file org.spongycastle.util itself contains the duplicate entry. I've seen this same issue in an xmlbean jar file. Android however doesn't like the duplicate entry. One way to get around this is to download that particular jar file and delete one of the duplicate entries and add the modified jar to your libs folder. Additionally, you'll need to exclude it from the appropriate compile dependency it is associated with. You'll need to test to be sure that deleting one of the duplicates doesn't break anything. If the contents of the two duplicate classes are equivalent, then deleting one of the duplicates wouldn't have any consequence.
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.
I'm pretty new to the Gradle build system and Android Studio and cannot quite figure out how to resolve this issue. My build is failing with:
* What went wrong:
Execution failed for task ':cyanEngine:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: javax/annotation/ParametersAreNullableByDefault.class
If I do Ctrl + N and search for ParametersAreNullableByDefault. One reference is pointing to External Libraries | jsr305-1.3.9. The other is pointing to classes.jar under xwalk_core_library.
xwalk_core_library is referenced in my xwalk_cordova module via:
{
android{
dependencies{
compile 'org.xwalk:xwalk_core_library:11.40.277.7'
}
}
And my app's gradle dependencies has:
compile project (':xwalk_cordova')
It seems like I need to get rid of the External Library, but I'm not sure where it's coming from.
Any pointers on how to resolve this?
Update:
I figured out the external reference was coming from Guava, referenced in the application build.gradle via compile ('com.google.guava:guava:11.0.2'). Just updating to Guava version 18.0 seems to get me past this for now. Guess the newer version no longer depends on jsr.
Still, I feel like I'll run into this again. Basically, we had two 3rd party libraries depending on the same library. What's the best way to clean this up?
I noticed for robolectic, there is an exclude, I'm guessing for similiar reasons:
testCompile('org.robolectric:robolectric:3.0-rc2') {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
I'm curious how this statement works and don't quite understand the Gradle docs. What is this statement saying? Where do 'group' and 'module' come from?
I am trying to apply material theme. After changing com.android.support:appcompat-v7:19.1.0 in build.gradle file to v7:21.0.0.-rc1 or v7:21+, i am getting following error:
Module version com.loopj.android:android-async-http:1.4.3 depends on
libraries but is not a library itself
com.loopj.android:android-async-http:1.4.3 dependency is in another build.gradle which is like a project inside main project.
dependencies {
compile 'com.loopj.android:android-async-http:1.4.3'
}
Update: I changed it to 1.4.4 but now I am getting:
Error:Execution failed for task ':mergeDebugManifests'. Manifest
merging failed. See console for more info.
As per this link, I have 'android-L' everywhere, still no luck
By modifying the answer found here: Crouton depends on libraries but is not a library itself
I changed the dependency declaration in build.gradle as follows:
compile('com.strongloop:loopback-android:1.+#aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
This seems to have solved it for me. If there is a better solution to this, I for one would like to hear what it is.
When I was trying to use Android Studio to debug my project, I got the following error,
Class com.google.ads.AdRequest.Gender has already been added to output. Please remove duplicate copies.
The cause seems to be that the google play services lib and another lib used by my project both contain the com.google.ads.AdRequest.Gender class, and I don't think I can remove it from either one.
Does anyone know how to fix this problem?
Thanks a lot.
I tried the following statement in build.gradle in order to exclude the duplicated classes in the google play services lib, but it still does not solve the problem.
compile ('com.google.android.gms:play-services:4.1.32') {
exclude group: 'com.google.ads'
}
You can try using Gradle's exclude mechanism when setting up the DatawindAdsSdk-2.0 dependency. There are docs available, but it will probably look something like this:
dependencies {
compile files('libs/datawindAdsSdk-2.0.jar') {
exclude group: 'com.google.ads'
}
}
experiment with that and see if you can get it working.
But I came to this post via google and I read this post has the same problem as me. I solved it excluding the group and the whole library. In my case the problem was with an animatorListener.
compile ('com.rengwuxian.materialedittext:library:1.8.2'){
exclude group: 'com.nineoldandroids', module: 'library'
}
This is my post duplicate library gradle animatorlistener duplicate