gradle duplicate entry FloatProperty - android

I have add spinnerwheel module into my project and it wouldn't build anymore. It has some kind of a duplicate entry with nineoldandroids library Which is included in spinnerwheel module . I get this error during the build
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/nineoldandroids/util/FloatProperty.class
I ran ../gradlew dependencies on the app folder and this is what i found under spinnerwheel module:
\--- *********-android3.5:spinnerwheel:unspecified
\--- LOCAL: nineoldandroids-2.2.0.jar
This is my build.gradle file :
dependencies {
compile 'com.android.support:appcompat-v7:22.0.+'
compile 'com.android.support:support-v4:22.+'
//noinspection GradleCompatible
compile 'com.android.support:multidex:1.0.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.facebook.android:facebook-android-sdk:3.23.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
compile 'org.apache.httpcomponents:httpclient:4.3.5'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.1'
compile project(':loopj')
compile project(':StackBlur')
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'
compile 'it.sephiroth.android.library.imagezoom:imagezoom:+'
compile 'com.navercorp.pulltorefresh:library:3.2.0#aar'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.getbase:floatingactionbutton:1.7.0'
compile 'com.afollestad:material-dialogs:0.6.6.3'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.github.traex.rippleeffect:library:1.2.3'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.11'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.github.johnpersano:supertoasts:1.3.4#aar'
compile 'com.github.johnkil.android-appmsg:appmsg:1.2.0'
compile('com.crashlytics.sdk.android:crashlytics:2.2.4#aar') {
transitive = true;
}
compile 'io.branch.sdk.android:library:1.5.5'
compile 'com.kyleduo.switchbutton:library:1.2.8'
}

just Add this compile 'compile 'com.nineoldandroids:library:2.4.0' in your gradle section And update minifyEnabled false instead minifyEnabled true Like

Related

duplicate Entry com/google/zxing/BarcodeFormat.class

When I am running the app on Android 6.0 and above directly through run from android studio then able to run the app successfully. But when creating a build through build apk from android studio then I am getting following error :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/BarcodeFormat.class**
Below is my gradle file :
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.6.1#aar') {
transitive = true;
}
compile('com.digits.sdk.android:digits:1.11.2#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile 'com.wdullaer:materialdatetimepicker:2.4.0'
compile 'com.google.android.gms:play-services:11.0.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.koushikdutta.ion:ion:2.1.8'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'testfairy:testfairy-android-sdk:1.+#aar'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.orhanobut:dialogplus:1.11#aar'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'dev.dworks.libs:volleyplus:+'
testCompile 'junit:junit:4.12'
}
You can exclude "com.google.zxing" module "core"
implementation('com.facebook.android:facebook-android-sdk:{VERSION}') {
exclude group: "com.google.zxing", module: 'core'
}
you need to use same version depedency of firebase
use this
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-auth:11.0.1'
instead of this
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-auth:11.0.1'
You might be having same file named as BarcodeFormat.java in your project. Please rename it to anything else and see if the error gets solved.

ZipExcepton: duplicate entry: com/google/android/gms/internal/zzpi.class

I am running into this issue every time I am trying to run my project.
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/google/android/gms/internal/zzpi.class
Here is my build script:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.15.2'
}
}
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/commons-collections4-4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/graphview-3.1.jar')
testCompile 'junit:junit:4.12'
compile project(':progresslibrary')
compile files('libs/gson-2.6.2.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.6.2#aar') {
transitive = true;
}
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2'
compile 'com.android.support:multidex:1.0.0'
compile 'com.hrules:charter:1.4.0'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.2'
//noinspection GradleCompatible
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15'
compile 'com.android.support:multidex:1.0.0'
compile 'com.hrules:charter:1.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.2'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
compile 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.snappydb:snappydb-lib:0.5.2'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.wdullaer:materialdatetimepicker:2.2.0'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.shamanland:fab:0.0.8'
compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'org.jsoup:jsoup:1.9.1'
compile 'com.flurry.android:analytics:6.2.0'
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.github.danielemaddaluno.androidupdatechecker:library:1.0.2'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}
android {
packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
}
apply plugin: 'build-announcements'
please tell me what is wrong with my build script
At a quick glance, I can tell you that the problem exists in Google Play Services. And I am going to guess that these all need to be the same version (grouped by same version here).
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
In order to efficiently do that, you can define an ext block in you Gradle file for keeping the version numbers consistent.
Additional note: This line compile fileTree(include: ['*.jar'], dir: 'libs')... It says compile all JAR files in the libs/ directory, therefore, these lines are pointless, and you can remove them while you try to identify where the error occurs.
compile files('libs/commons-collections4-4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/graphview-3.1.jar')
compile files('libs/gson-2.6.2.jar')
Sample build.gradle
ext {
// Variables to keep libraries consistent
supportLibrary = "23.2.0"
googlePlayServicesVersion = '9.4.0'
// Support Libraries dependencies
supportDependencies = [
design : "com.android.support:design:${supportLibrary}",
recyclerView : "com.android.support:recyclerview-v7:${supportLibrary}",
cardView : "com.android.support:cardview-v7:${supportLibrary}",
appCompatV7 : "com.android.support:appcompat-v7:${supportLibrary}"
]
googlePlayServicesDepends = [
analytics : "com.google.android.gms:play-services-analytics:${googlePlayServicesVersion}"
plus : "com.google.android.gms:play-services-plus:${googlePlayServicesVersion}"
location : "com.google.android.gms:play-services-location:${googlePlayServicesVersion}"
fitness : "com.google.android.gms:play-services-fitness:${googlePlayServicesVersion}"
appindexing : "com.google.android.gms:play-services-appindexing:${googlePlayServicesVersion}"
auth : "com.google.android.gms:play-services-auth:${googlePlayServicesVersion}"
gcm : "com.google.android.gms:play-services-gcm:${googlePlayServicesVersion}"
]
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile supportDependencies.appCompatV7
// compile supportDependencies.recyclerView
// recommended - includes those above
compile supportDependencies.design
// extras
compile supportDependencies.cardView
// The correct Volley library
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile "com.google.code.gson:gson:2.6.2"
// Google Play Services
compile googlePlayServicesDepends.location
// TODO: Add others
}

For below android version-5 i am getting ZipException with duplicate entry: com/google/api/client/http/AbstractHttpContent.class

Not able to install app in android version 4.4 I am getting error like:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/api/client/http/AbstractHttpContent.class
I have tried this solution but it didn't worked for me.
Here is my app dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.google.code.gson:gson:2.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-nearby:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile('com.twitter.sdk.android:twitter:1.13.0#aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile project(':library')
compile project(':facebook-android-sdk-4.8.1')
}
dependencies for library module
dependencies {
compile 'com.android.support:support-annotations:22.2.0'
}

TransformException duplicate entry for android.support.annotation.AnyRes.class

I'm getting following error when tried to build project.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:android/support/annotation/AnyRes.class
I tried to solve with the help of link here, But it's not working.
My build.gradle is below
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gson-2.2.2.jar')
compile files('libs/okhttp-2.2.0.jar')
compile files('libs/okhttp-urlconnection-2.0.0.jar')
compile files('libs/okio-1.0.0.jar')
compile files('libs/retrofit-1.9.0.jar')
compile files('libs/easyandroidanimationslibrary.jar')
compile project(':materialDialog')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'jp.wasabeef:recyclerview-animators:1.3.0'
compile 'com.github.rey5137:material:1.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile "com.google.android.gms:play-services:8.3.0"
}
I've added
multiDexEnabled true
in defaultConfig

Gradle - ProGuard - DuplicateClasses - NineOldAndroids

I use some libraries/modules for my project.
On two of the libraries there are "nineoldandroids" used in the gradle with "-compile 'com.nineoldandroids:library:2.4.0'" on every library/module !
If I want to crate an APK in Android Studio with "Build - Generate Signed APK" I get always the "ProGuard" error "duplicateclasses" with following error:
Error:Execution failed for task ':xxxxx:proguardRelease'.
> java.io.IOException: Can't write
[F:\Projekte\Android_Studio\xxxx\build\intermediates\classes-proguard\
release\classes.jar] (Can't read
[F:\Projekte\Android_Studio\xxxx\build\intermediates\exploded-aar\
Android_Studio\library_SwipeListView\unspecified\libs\
nineoldandroids-2.4.0.jar(;;;;;;!META-INF/MANIFEST.MF)]
(Duplicate zip entry [com/b/a/b.class == nineoldandroids-2.4.0.jar:com
/nineoldandroids/animation/Animator$AnimatorListener.class]))
How can I solve this error?
SwipeListView:
dependencies {
compile 'com.android.support:support-v4:20.0.0'
compile 'com.nineoldandroids:library:2.4.0'
}
NumberPickerCompat:
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
}
MainProject:
dependencies {
compile project(':library_CalendarViewCompbat')
compile project(':library_FAB_Menu')
compile project(':library_NumberPickerCompat')
compile project(':library_ReminderDatePicker')
compile project(':library_StickyListHeaders')
compile project(':library_SwipeListView')
compile project(':library_SunDate_Picker')
compile 'com.google.android.gms:play-services:6.1.+'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:support-v4:20.0.0'
compile files('libs/crashlytics.jar')
compile files('libs/dashclock-api-r1.1.jar')
compile files('libs/dropbox-android-sdk-1.5.3.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
}
You can exclude one of the nineoldandroids transitive dependencies from your main project :
dependencies {
compile project(':library_NumberPickerCompat')
compile(project(':library_SwipeListView')) {
// Already present in NumberPickerCompat
exclude group: 'com.nineoldandroids'
}
...
}
Please note the extra parentheses on the second compile dependency
Thanks all for your answers.
The problem was that some .jar files are saved in some "build" folders.
This was because I have migrated from Eclipse with the .jars and have later deleted it and added the compile to gradle.
But I haven't seen that in the "build" folders they are saved too.
Try this:
SwipeListView:
dependencies {
compile 'com.android.support:support-v4:20.0.0'
}
NumberPickerCompat:
dependencies {
}
MainProject:
dependencies {
//put nineoldandroids in main project
compile 'com.nineoldandroids:library:2.4.0'
compile project(':library_CalendarViewCompbat')
compile project(':library_FAB_Menu')
compile project(':library_NumberPickerCompat')
compile project(':library_ReminderDatePicker')
compile project(':library_StickyListHeaders')
compile project(':library_SwipeListView')
compile project(':library_SunDate_Picker')
compile 'com.google.android.gms:play-services:6.1.+'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:support-v4:20.0.0'
compile files('libs/crashlytics.jar')
compile files('libs/dashclock-api-r1.1.jar')
compile files('libs/dropbox-android-sdk-1.5.3.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
}

Categories

Resources