I have a problem when I try to generate an apk with Android Studio 2.3
I'm getting an error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/antlr/v4/runtime/ANTLRErrorListener.class
I understand that some of my dependencies must implement the same methods, but I can't figure out which one,
Here are my dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.graphql-java:graphql-java:2016-10-19T14-40-14'
compile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.altbeacon:android-beacon-library:2.12.2'
compile 'io.fotoapparat.fotoapparat:library:1.4.1'
testCompile 'junit:junit:4.12'
}
Thank you
You can exclude the antlr4 in the dependency with:
compile('com.graphql-java:graphql-java:2016-10-19T14-40-14') {
exclude module: 'antlr4'
}
You can find the related issues here:
https://github.com/graphql-java/graphql-java/issues/225
https://github.com/graphql-java/graphql-java/issues/254
Related
I am getting this error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/volley/AuthFailureError.class
I attached my gradle please check and help me.
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/android-async-http-1.4.4.jar')
compile files('libs/disklrucache-2.0.1.jar')
compile files('libs/google-gson.jar')
compile project(':linkedin-sdk')
compile files('libs/PGSDK_V2.0.jar')
compile 'com.android.support:support-v13:25.3.1'
compile files('libs/okhttp-1.2.1-jar-with-dependencies.jar')
compile files('libs/volley.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.razorpay:checkout:1.4.1'
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.jjoe64:graphview:4.2.0'
}
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/android/volley/AuthFailureError.class
Remove
compile files('libs/volley.jar') // From local lib also
Use
compile 'com.android.volley:volley:1.0.0'
I am using linkedin sdk,inside linkedin adk also one volley compile is
there and my app level I have one more volley dependency.
You should call volley:1.0.0 there.
Remove Below jar file from gradle
compile files('libs/volley.jar')
compile files('libs/google-gson.jar')
and compile below dependency
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services-auth:11.4.0'
I'm trying to run some tests into Firebase test lab platform and I'm finding a problem:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebugAndroidTest'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: junit/extensions/ActiveTestSuite$1.class
The tests works fine when I run them locally in a virtual device.
I'm working all day in this and I can't find a valid solution for me :(
Here's my dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Dagger
// apt command comes from the android-apt plugin
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.appyvet:materialrangebar:1.3'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.google.firebase:firebase-appindexing:11.0.2'
compile 'com.google.android.gms:play-services-analytics:11.0.2'
compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-config:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.google.firebase:firebase-invites:11.0.2'
compile 'com.google.firebase:firebase-perf:11.0.2'
compile 'com.google.firebase:firebase-crash:11.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.squareup.okio:okio:1.7.0'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile 'com.appsflyer:af-android-sdk:4.7.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.dagger:dagger:2.9'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.1.4'
testCompile 'org.robolectric:shadows-multidex:3.0'
testCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:25.3.1'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
exclude module: 'javax.annotation-api'
exclude module: 'support-annotations'
}
androidTestCompile ('com.android.support.test.uiautomator:uiautomator-v18:2.1.2') {
exclude module: 'javax.annotation-api'
exclude module: 'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2') {
// Necessary to avoid version conflicts
exclude module: 'support-v4'
exclude module: 'recyclerview-v7'
exclude module: 'appcompat-v7'
exclude module: 'support-annotations'
exclude module: 'design'
}
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
provided 'javax.annotation:jsr250-api:1.0'
Thank you very much
I'd start by determining which libraries are using a class with that name.
Android Studio you can use open file and type ActiveTestSuite. This will autocomplete with all the matching classes. For example, when I do this it seems to come from a junit class.
I'm not sure why you would only see this on Firebase. Possibly see if there's a flag to ensure the test build runs a clean operation before running.
I have shared graddle Image HereError:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/content/res/TypedArrayUtils.class
This error usually occurs when there is duplication of dependencies in gradle file. Check your app gradle file again, search for duplicate dependencies.
For instance, if google services of version 9.2.0 is added and another google service version for instance say maps is added with version 10.0.0 so here conflict will occur hence resulting with this error
Lİke #Techlnsect mentioned above we need to give direct import, try to remove ++ at the end of compiling element and find suitable for your work
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:2+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:multidex:1.0.0'
}
I changed it to and problem gone
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:multidex:1.0.0'
}
Please let me know what exactly require here, I can see same source is running fine in Android Studio Emulators but in third party emulators like bluestacks I can see following errors.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/activeandroid/ActiveAndroid.class
Please check my gradle dependencies here.
dependencies {
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile files('library/android-viewbadger.jar')
compile files('library/robobinding-0.8.1.jar')
compile files('library/activeandroid-3.1-SNAPSHOT.jar')
compile project(':Android-Validator')
// compile files('library/java-rt-jar-stubs-1.5.0.jar')
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.0.1'
compile ('com.android.support:appcompat-v7:25.0.1'){
exclude module: 'support-v4'
}
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.f2prateek.progressbutton:progressbutton:2.1.0#aar'
compile files('library/afreechart-0.0.4.jar')
compile 'commons-io:commons-io:+'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.google.guava:guava:16+'
compile 'joda-time:joda-time:2.9.4'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.sun.codemodel:codemodel:2.4.1'
compile 'org.apache.httpcomponents:httpmime:4.5.1'
compile 'ch.acra:acra:4.9.0'
compile 'org.jsoup:jsoup:1.10.2'
compile 'org.apache.commons:commons-lang3:3.4'
compile ('org.simpleframework:simple-xml:2.7.1'){
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile files('library/pdfjet-5.75.jar')
compile 'log4j:log4j:1.2.17'
compile 'com.splunk:mint-android-sdk:5.2.1'
compile 'de.mindpipe.android:android-logging-log4j:1.0.3'
compile files('library/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
}
This issue usually came when the same class is added in gradle twice.
Why you are using
compile files('library/activeandroid-3.1-SNAPSHOT.jar')
and
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
This is the reason for this.Try adding it once only and then build the gradle and run
Logcat Error:
Error:Execution failed for task ':app:packageAllLocalVersionDebugClassesForMultiDex'.>java.util.zip.ZipException: duplicate entry: bolts/AggregateException.class
App Gradle Dependency:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
compile 'com.daimajia.swipelayout:library:1.1.8#aar'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.facebook.fresco:fresco:0.9.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile project(':floating_button_library')
compile 'com.facebook.android:facebook-android-sdk:4.10.0'
}
After adding the dependency for Facebook SDK the build throws an Exception
suggest me an answer thanks..
EDIT:
SOLVED THE ERROR
Now they split bolts-android into bolts-applinks and bolts-tasks .so you need exclude both from the gradle build
compile ('com.facebook.android:facebook-android-sdk:4.10.0'){
exclude group: 'com.parse.bolts',
module: 'bolts-tasks'
exclude group: 'com.parse.bolts',
module: 'bolts-applinks';}
This works perfectly for me !!!!
there were two DIFFERENT versions of it conflicting. the facebooksdk
comes with bolts-android-1.1.x and appcompatv7 comes with 1.1.x.
so add below line,
compile ('com.facebook.android:facebook-android-sdk:4.10.0'){
exclude module: 'bolts-android'
exclude module: 'support-v4'
}