ZipException: duplicate entry: com/android/volley/AuthFailureError - android

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/android/volley/AuthFailureError.class
and this is my gradle build file:
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:appcompat-v7:25.3.1'
//compile 'com.facebook.android:facebook-android-sdk:4.14.0'
compile project(path: ':linkedin-sdk')
// compile 'com.mcxiaoke.volley:library-aar:1.0.0'
// compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.paolorotolo:expandableheightlistview:1.0.0'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:support-core-utils:25.3.1'
compile 'com.google.android.gms:play-services-maps:9.0.1'
compile 'com.google.android.gms:play-services-location:9.0.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
testCompile 'junit:junit:4.12'
}
The app works fine with the new version of the API.
But it has the problem with older versions of the API.

You seem to be confused about how to get Volley in your app
// compile 'com.android.volley:volley:1.0.0'
// compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
Those last two are deprecated. The first line is correct.
https://developer.android.com/training/volley/index.html
And you need to remove any Volley related files from the libs directory, plus make sure LinkedIn library also isn't using volley
I don't see why you need it though when you have Okhttp for http calls and Glide and Picasso for image loading
Related errors will arise from mixing 25.3.1, 23.0.1, 23.1.1, and 25.1.1 support libraries. Those all need to be the exact same

multiDexEnabled true
Add above line into your build.gradle file in defaultConfig like this:
defaultConfig{
multiDexEnabled true
}

You can test putting this on root of directory in the Terminal
./gradlew clean

Related

Build failed with bytecode error in Android Studio

I have this error:
I have enabled multidex but still it gives me multidex files define issues.
compile fileTree(include: ['*.jar'], dir: 'libs')
// Navigation Drawer Library
compile('com.mikepenz:materialdrawer:5.3.0#aar') {
transitive = true
}
// Debugger Tools libraries
debugCompile 'com.facebook.stetho:stetho:1.2.0'
debugCompile 'com.parse:parseinterceptors:0.0.2'
//Google, Inc (Play services) Libraries
compile 'com.google.android.gms:play-services-maps:9.2.0'
// Google, Inc (Support) Libraries
compile 'com.android.support:support-v13:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
// Parse Server API SDK
compile project(':ParseUI-Widget')
compile 'com.parse:parse-android:1.13.1'
compile 'com.parse.bolts:bolts-android:1.4.0'
compile 'com.github.tgio:parse-livequery:1.0.3'
compile 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
// Facebook, Inc SDKs
compile 'com.facebook.android:audience-network-sdk:4.18.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.facebook.android:account-kit-sdk:4.+'
// Libraries for loading images
compile 'com.facebook.fresco:imagepipeline-okhttp3:0.11.0+'
compile 'com.facebook.fresco:fresco:1.0.0'
// Location Helper Library
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
// Time library
compile 'joda-time:joda-time:2.9.7'
// Accelaration library
//compile 'com.neumob:neumob-android:3.2.4'
// Others
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile files('libs/mint-4.4.0.jar')
I have added build.gradle file.
I don't know how to solve Multidex issue in Android. My app has lots of SDKs integration, I went through lots of tutorials and blogs. I got so many solutions. One of them is below mentioned as part of my gradle.
apply plugin: 'com.google.gms.google-services'
classpath 'com.google.gms:google-services:3.1.1'

error when i want to compile gradle zxing

im trying to use zxing to scan barcode using android studio
but when i try to add zxing gradle i got this error
Error:Execution failed for task ':app:transformClassesWithJarMergingForAristiDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/BarcodeFormat.class
this is what all gradle i have
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.karumi:dexter:2.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'me.dm7.barcodescanner:zxing:1.9'
testCompile 'junit:junit:4.12'
can somebody tell me what should i do ?? Or what should i search to remove this error ?
Sorry because i was newbie in java i dont know how to solve simple problem like this. After searching for a week im already found how to solve.
The problem is my jar contain same class in same directory this why i got this error. In my case, it was solved after i exclude which directory who cause this
compile ('me.dm7.barcodescanner:zxing:1.9.3'){
exclude group: 'com.google.zxing'
}

Paytab Payment gateway not working

I have to integrate paytabs payment gateway. After integrating their sdk module, the application not builds & app gets an error. My app gradle has below dependency.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.afollestad.material-dialogs:core:0.9.1.0'
compile 'com.kyleduo.switchbutton:library:1.4.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile project(':PayTabs_SDK_SRC')
}
The Error looks like:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: okhttp3/Address.class
Update:
If i remove below two dependency i don't get any error. But must have to use this
retrofit dependence. Any Idea?
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
Look, PayTabs SDK includes
com.squareup.okhttp3(version 3.5.0) and com.squareup.retrofit2:retrofit:2.2.0 uses okhttp3(version 3.6.0) which confused Gradle and generates a dexException(duplicate files exception).
To solve this problem you need to exclude one of okhttp3 version. Replace these below lines in build.gradle file.
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
With these lines of code:
compile ('com.squareup.retrofit2:retrofit:2.2.0'){
exclude group: "com.squareup.okhttp3"
}
compile ('com.squareup.retrofit2:converter-gson:2.2.0'){
exclude group: "com.squareup.okhttp3"
}
Hope it will work.

':app:dexDebug'. com.android.ide.common.process.ProcessException

If I add paypal sdk then I get this problem else my project is running successfully.
Can some tell me from which dependency it is conflicting?
Here are my dependencies...
compile 'com.android.support:support-v13:23.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile files('libs/PayPalAndroidSDK-2.11.1.jar'
I removed build files and rebuilt the project but no hope and strange part is I have one dummy project where I write code first, in that project everything working fine but here getting error always.
Paypal library includes GSON dependency and Retrofit too, you have to exclude the GSON dependency from retrofit.

Gradle build fails with duplicates when adding google-api-client

I am adding code to my project which requires google-api-client, when I add it via the gradle dependency, I get a duplicate error.
Here is the gradle dependency list
dependencies {
compile 'com.adobe.creativesdk:image:4.0.0'
// compile project(':showcaseView')
compile project(':facebook')
compile project(':SwipeMenuListView')
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:design:22.2.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.android.gms:play-services:7.5.+'
compile 'com.google.android.gms:play-services-appinvite:7.5.0'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'org.apache.httpcomponents:httpcore:4.3.3'
compile 'commons-codec:commons-codec:1.9'
compile 'commons-io:commons-io:2.4'
compile 'com.google.gdata:core:1.47.1'
compile files('libs/tape-1.1.0.jar')
compile files('libs/gdata-photos-meta-2.0.jar')
compile 'com.google.api-client:google-api-client:1.20.0'
// compile 'com.google.http-client:google-http-client:1.20.0'
// compile files('libs/android-oauth-client-0.4.5.jar')
}
Here is the error that I receive
Execution failed for task ':FloomIt:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/common/collect/package-info.class
If I remove the google-api-client line from the dependency list, the error goes away.
Any suggestions on how to proceed?
That is because com.google.api-client:google-api-client depends on com.google.guava:guava-jdk5 but com.google.gdata:core depends on com.google.guava:guava. The JDK5 split is unfortunate.
Gradle allows you to override dependencies. Try replacing the gdata dependency with something like:
compile('com.google.gdata:core:1.47.1') {
exclude group: 'com.google.guava', module: 'guava'
}

Categories

Resources