Proguard issue Roboguice duplicate import - android

I am running to an issue when i run my gradle build. It seems like there are duplicate dependencies getting imported but finding it hard to debug, any suggestions would be great.
Error:Execution failed for task ':proguardDebug'.
java.io.IOException: Can't write [.......\build\intermediates\classes-proguard\debug\classes.jar] (Can't read [.......gradle\caches\modules-2\files-2.1\org.roboguice\roboguice\3.0.1\24e814f35d5cc28eaa7e9f07a50ea69deeb2b544\roboguice-3.0.1.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [roboguice-3.0.1.jar:javax/inject/Inject.class]))
dependencies {
repositories {
mavenCentral()
}
compile 'com.google.android:multidex:0.1'
compile files('libs/aws-android-sdk-1.7.1.1.jar')
compile 'com.makeramen:roundedimageview:1.3.0'
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
compile 'com.squareup.picasso:picasso:2.3.3'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.google.android.gms:play-services:+'
compile 'com.androidmapsextensions:android-maps-extensions:2.1.+'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:20.+'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
compile('com.commonsware.cwac:camera-v9:0.6.+') {
exclude module: 'support-v4'
}
compile 'com.squareup:otto:1.3.6'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.okio:okio:1.2.0'
compile project(':libraries:facebook')
compile files('libs/Catalano.Core.jar')
compile files('libs/Catalano.Android.Image.jar')
compile files('libs/Catalano.Math.jar')
compile 'org.roboguice:roboguice:3.+'
provided 'org.roboguice:roboblender:3.+'
compile 'com.google.code.findbugs:jsr305:3.0.0'
compile 'com.android.support.test.espresso:espresso-core:2.0'
compile 'com.android.support.test:testing-support-lib:0.1'
compile 'com.android.support.test.espresso:espresso-contrib:2.0'
compile 'junit:junit:4.12'
compile 'org.hamcrest:hamcrest-core:1.1'
compile 'org.hamcrest:hamcrest-library:1.1'
compile 'org.hamcrest:hamcrest-integration:1.1'
compile('org.robolectric:robolectric:2.4') {
exclude module: 'classworlds'
exclude module: 'commons-logging'
exclude module: 'httpclient'
exclude module: 'maven-artifact'
exclude module: 'maven-artifact-manager'
exclude module: 'maven-error-diagnostics'
exclude module: 'maven-model'
exclude module: 'maven-project'
exclude module: 'maven-settings'
exclude module: 'plexus-container-default'
exclude module: 'plexus-interpolation'
exclude module: 'plexus-utils'
exclude module: 'wagon-file'
exclude module: 'wagon-http-lightweight'
exclude module: 'wagon-provider-api'
}

You can figure out what is pulling in dependencies by running this command in your project root:
./gradlew app:androidDependencies
You will get output similar to this:
Also, don't forget to check your app/libs/ folder to ensure it's empty if you're pulling everything in with Gradle.

Related

More than one file was found with OS independent path 'org/apache/http/client/version.properties'

Every thing working fine before updating Android studio from 2.3 to 3.0. I had this error when running app in Android Studio, complile is pass. I can't understand why this error appears. And I found nothing in Internet.
here is my gradle file.
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
repositories {
mavenCentral()
google()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/DraggableGridView.jar')
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile files('libs/android-query-full.0.26.7.jar')
compile project(':gestureimageview')
compile files('libs/commons-lang3-3.5.jar')
compile files('libs/json_simple-1.1.jar')
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile group: 'com.dropbox.core', name: 'dropbox-core-sdk', version: '3.0.4', changing: true
// compile 'com.dropbox.core:dropbox-core-sdk:3.0.4'
// compile 'ly.img.android:photo-editor-sdk:5.0.0-beta'
// compile 'com.github.thorbenprimke:realm-searchview:0.9.6'
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.2'
// releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.2'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.matthew-tamlin:sliding-intro-screen:3.2.0'
compile 'com.instabug.library:instabug:4.3.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:customtabs:25.4.0'
compile 'com.android.support:palette-v7:25.4.0'
compile 'com.android.support:multidex:1.0.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'ly.img.android:photo-editor-sdk:5.0.6'
compile 'de.morrox.fontinator:Fontinator:1.1.3'
compile 'com.google.android.gms:play-services-drive:11.4.2'
compile 'com.romandanylyk:pageindicatorview:0.0.7'
compile 'com.android.support:support-annotations:27.0.0'
compile 'com.android.support:support-compat:25.4.0'
compile 'com.android.support:support-core-ui:25.4.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'pl.bclogic:pulsator4droid:1.0.3'
compile 'com.google.android.gms:play-services-identity:11.4.2'
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.apis:google-api-services-drive:v2-rev247-1.22.0'
testCompile 'junit:junit:4.12'
}
here is error I am getting every time
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
More than one file was found with OS independent path 'org/apache/http/client/version.properties'
Just add
packagingOptions {
exclude 'org/apache/http/version.properties'
exclude 'org/apache/http/client/version.properties'
}
in your app build.xml then
Clean/sync project.
Hope this helps.

ZipException: duplicate entry: junit/extensions/ActiveTestSuite$1.class when running tests in firebase

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.

app:transformClassesWithJarMergingForDebug FAILED

when I try to run the app I am getting this error
before
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzsk.class
Now
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzqz$zza.class
I referred this,this and this. Tried the solutions mentioned there. Still I am far away from solving the Issue.
Please have a look on the app build gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile('com.android.support:appcompat-v7:23.1.1') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.android.support:recyclerview-v7:23.1.1') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.android.support:cardview-v7:23.1.1') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.android.support:design:23.1.1') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.clevertap.android:clevertap-android-sdk:2.0.11'
compile 'com.android.support:support-v4:23.1.1'
compile('com.google.android.gms:play-services-analytics:8.3.0')
{
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.google.guava'
}
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile "com.squareup.picasso:picasso:2.4.0"
compile('com.google.android.gms:play-services-gcm:8.3.0') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.google.guava'
}
compile('com.google.android.gms:play-services:8.3.0') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.google.guava'
}
compile 'de.hdodenhof:circleimageview:1.3.0'
compile project(':volley')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.android.support:multidex:'
apply plugin: 'com.google.gms.google-services'
}
I am happy to provide more information if needed.
UPDATE
When I comment compile 'com.clevertap.android:clevertap-android-sdk:2.0.11' It is working fine.
please check if some of your dependencies have multidex as dependency and exclude it. For example for Facebook SDK: you have this
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
change to this
compile('com.facebook.android:facebook-android-sdk:4.7.0') {
exclude group: 'com.android.support', module: 'multidex'
}
and check for other also.
Solved the issue by updating the com.google.android.gms:play-services version
from 8.3.0 to 8.4.0

ZipException: duplicate entry: android/support/annotation/AttrRes.class

I am facing, Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: android/support/annotation/AttrRes.class
build.gradle file (main project)
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-location:7.8.0'
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-nearby:7.8.0'
compile ('com.android.support:recyclerview-v7:+') {
exclude module: 'support-v4'
}
compile 'com.firebase:firebase-client-android:2.3.1+'
compile ('com.android.support:cardview-v7:22.0.+') {
exclude module: 'support-v4'
}
compile ('com.squareup.okhttp:okhttp:2.4.0') {
exclude module: 'support-v4'
}
compile ('com.squareup.picasso:picasso:2.5.2') {
exclude module: 'support-v4'
}
compile ('com.squareup.retrofit:retrofit:2.0.0-beta1') {
exclude module: 'support-v4'
}
compile('com.squareup.retrofit:converter-gson:2.0.0-beta1') {
exclude module: 'gson'
}
compile('com.segment.analytics.android:all:2.5.1#aar') {
transitive = true
exclude module: 'support-v4'
}
compile ('com.android.support:design:22.2.0') {
exclude module: 'support-v4'
}
compile('com.uservoice:uservoice-android-sdk:1.2.+') {
exclude module: 'commons-logging'
exclude module: 'httpcore'
exclude module: 'httpclient'
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
compile project(':contactsChipView')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile project(':facebook-android-sdk-4.0.1')
compile ('com.android.support:multidex:1.0.0'){
exclude module: 'support-v4'
}
Files in /libs directory (main project):
gson-2.2.3.jar
Parse-1.9.2.jar
YoutubeAnddroidPlayerApi.jar
Files in /libs directory (facebook module):
android-support-v4.jar
bolts.jar
As you can see the above gradle file, I have tried adding exclude for almost all dependencies. But still, no luck.
I also tried changing build tools from 22.0.1 to 22.0.0, even this didn't work.
I went through other posts, but no luck.
Anybody knows how to solve this?

UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexIndexOverflowException: Cannot merge new index 65817 into a non-jumbo instruction

I am facing that problem when I try to build my project on Android Studio. Below is gradle message build:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: Cannot merge new index 65817 into a non-jumbo instruction!
at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:109)
at com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:26)
at com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:72)
at com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)
at com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)
at com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:49)
at com.android.dx.merge.DexMerger.transformCode(DexMerger.java:842)
at com.android.dx.merge.DexMerger.transformMethods(DexMerger.java:813)
at com.android.dx.merge.DexMerger.transformClassData(DexMerger.java:786)
at com.android.dx.merge.DexMerger.transformClassDef(DexMerger.java:682)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:542)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
An here are my dependencies:
dependencies {
// Include and complie all file in libs folder
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'com.newrelic.agent.android:android-agent:5.2.1'
compile('com.sromku:simple-fb:4.0.5') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile('com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile('com.sothree.slidinguppanel:library:2.+') {
exclude group: 'com.nineoldandroids'
}
compile('com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile(project(':FloatLabel')) {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.nineoldandroids'
}
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.melnykov:floatingactionbutton:1.3.0'
}
I have found many questions similar this one but those solutions didn't work with me. How can I resolve this problem?
You could use the multidex support library for android versions below 5.0
Refer : https://developer.android.com/tools/support-library/features.html#multidex
There are two possible ways to fix your problem:
Use multiDex, but that comes with some drawbacks (see Limitations in the provided link)
Configure and use ProGuard to reduce the general footprint of your app. ProGuard will strip unused code from your app and its libraries and might also significantly reduce the size of your apk.

Categories

Resources