Android project building failed with `TransformException` - android

My Android project build success with Android Studio 2.3, but on Android Studio 3.0.0-alpha7, it throws this exception:
:app:transformClassesWithJarMergingForStagingDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForStagingDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/facebook/R$attr.class
There is only 1 library that working with Facebook and declare Facebook SDK inside:
compile('ly.kite:facebook-photo-picker:1.2.0') {
exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
}
Is this problem of Android Studio or Library?
*Update: * This is entire dependencies in the project:
dependencies {
provided fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.amazonaws:aws-android-sdk-core:2.2.13'
compile 'com.amazonaws:aws-android-sdk-mobileanalytics:2.2.13'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.13'
compile 'com.isseiaoki:simplecropview:1.1.4'
compile 'com.jpardogo.materialtabstrip:library:1.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.daasuu:animateHorizontalProgressBar:0.2.0'
compile 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
compile 'com.makeramen:roundedimageview:2.2.1'
provided files('libs/isoviewer-1.0-RC-28.jar')
provided files('libs/gcm.jar')
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile 'com.ms-square:expandableTextView:0.1.4'
compile 'net.lingala.zip4j:zip4j:1.3.2'
compile 'com.apptentive:apptentive-android:3.0.0'
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.github.delight-im:Android-SimpleLocation:v1.0.1'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.github.alex-townsend:SwipeOpenItemTouchHelper:1.2.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.pusher:pusher-java-client:0.3.3'
compile 'com.google.code.gson:gson:2.7'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
// compile 'com.github.boxme:squarecamera:1.1.0'
compile "com.daimajia.swipelayout:library:1.2.0#aar"
compile 'com.daimajia.androidanimations:library:1.1.2#aar'
compile 'jp.wasabeef:recyclerview-animators:2.1.0'
compile 'com.github.lamydev:android-notification:3.0'
compile 'com.afollestad:material-camera:0.2.14'
compile 'at.blogc:expandabletextview:1.0.3'
compile 'com.commonsware.cwac:cam2:0.6.6'
compile 'com.squareup.moshi:moshi:1.2.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'org.slf4j:slf4j-api:1.7.13'
compile 'com.github.tony19:logback-android-core:1.1.1-4'
compile 'com.github.tony19:logback-android-classic:1.1.1-4'
compile('com.papertrailapp:logback-syslog4j:1.0.0') {
exclude group: 'ch.qos.logback'
}
compile 'com.github.darsh2:MultipleImageSelect:3474549'
compile "com.mixpanel.android:mixpanel-android:4.9.8"
compile 'com.intuit.sdp:sdp-android:1.0.4'
// compile "com.google.android.gms:play-services:7.5.0+"
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6#aar') {
transitive = true
}
compile 'net.yazeed44.imagepicker:imagepicker:1.3.0'
compile 'com.github.IHNEL:android-media-picker:git_hub-SNAPSHOT'
compile 'me.amiee:nicetab:1.0.0'
compile 'io.github.rockerhieu:emojicon:1.4.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile('ly.kite:facebook-photo-picker:1.2.0') {
exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
}
compile 'com.github.IHNEL:android-oauth2-client:-SNAPSHOT'
compile 'com.github.IHNEL:emojicon:-SNAPSHOT'
}

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.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/multidex/MultiDex$V14.class

this is my build.gradle,when I run app ,it report this error mesaage:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/multidex/MultiDex$V14.class
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
compile project(':pullToRefreshLibrary')
compile files('libs/flame.jar')
compile files('libs/httpclient-4.2.4.jar')
compile files('libs/httpcore-4.2.4.jar')
compile files('libs/httpmime-4.2.4.jar')
compile files('libs/mp3agic.jar')
compile files('libs/libammsdk.jar')
compile files('libs/ShareSDK-Core-2.8.3.jar')
compile files('libs/oraleval-android-sdk.jar')
compile 'fm.jiecao:jiecaovideoplayer:5.5.2#aar'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
//google play
compile 'com.uwetrottmann.photoview:library:1.2.4'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.4'
compile 'com.wdullaer:materialdatetimepicker:2.5.0'
compile 'com.getui:sdk:2.9.5.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//Logger
compile 'com.orhanobut:logger:2.1.1'
compile files('libs/xUtils-2.6.14.jar')
compile files('libs/mta-sdk-1.6.2.jar')
compile files('libs/open_sdk_r5793.jar')
//wechat
compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:1.0.2'
//banner
compile 'com.youth.banner:banner:1.4.9'
//recyclerview
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.nineoldandroids:library:2.4.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//cardview
compile 'com.android.support:cardview-v7:23.1.1'
compile files('libs/AndroidPicker-1.5.3.jar')
compile 'com.tencent.bugly:crashreport:latest.release'
compile 'com.tencent.bugly:nativecrashreport:latest.release'
compile files('libs/fastjson-1.2.5.jar')
compile project(':photodraweeview')
compile 'com.facebook.fresco:fresco:0.11.0'
compile 'com.facebook.fresco:animated-gif:0.11.0'
compile 'org.litepal.android:core:1.5.0'
compile 'com.jcodecraeer:xrecyclerview:1.3.2'
compile files('libs/giisosdk.jar')
compile 'com.android.support:multidex:1.0.1'
}
First of all, you need to use the same version for support library, like this:
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
//cardview
compile 'com.android.support:cardview-v7:23.1.1'
Then try only use one of JSON library, gson or fastjson:
compile 'com.google.code.gson:gson:2.7'
//compile files('libs/fastjson-1.2.5.jar')

How to fix error duplicate entry: com/coremedia/iso/AbstractBoxParser$1.class?

After add isoparser-1.0.6.jar into lib folder, I got error something like this
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/coremedia/iso/AbstractBoxParser$1.class
And this is my gradle:
dependencies {
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
compile files('libs/vdopialwsdk.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/httpmime-4.4-beta1.jar')
compile files('libs/httpcore-4.4.jar')
compile files('libs/isoparser-1.0.6.jar')
compile files('libs/android-websockets-master.jar')
compile files('libs/zcsprinterV.jar')
compile project(':library')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:gridlayout-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:palette-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
compile 'com.github.quentin7b:android-location-tracker:3.2'
compile group: 'org.igniterealtime.smack', name: 'smack-resolver-minidns', version: '4.1.7'
compile group: 'org.igniterealtime.smack', name: 'smack-extensions', version: '4.1.7'
compile group: 'org.igniterealtime.smack', name: 'smack-tcp', version: '4.1.7'
compile group: 'org.igniterealtime.smack', name: 'smack-legacy', version: '4.1.7'
compile group: 'org.igniterealtime.smack', name: 'smack-sasl-provided', version: '4.1.7'
compile group: 'org.igniterealtime.smack', name: 'smack-android', version: '4.1.7'
compile "org.igniterealtime.smack:smack-bosh:4.1.7"
compile 'com.rockerhieu.emojicon:library:1.3.1'
compile 'com.soundcloud.android:android-crop:1.0.0#aar'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.github.clans:fab:1.6.1'
compile 'com.android.support:customtabs:23.1.0'
compile 'com.github.ozodrukh:CircularReveal:1.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.0'
compile 'com.newrelic.agent.android:android-agent:5.+'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:palette-v7:23.1.0'
compile 'org.jetbrains:annotations:13.0'
compile 'jp.wasabeef:glide-transformations:1.2.1'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'de.greenrobot:androidsvg:1.2.2-beta-1-tweaked-2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.github.aakira:expandable-layout:1.6.0#aar'
compile 'jp.wasabeef:picasso-transformations:2.1.0'
compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.github.ybq:Endless-RecyclerView:1.0.3'
compile 'life.knowledge4:k4l-video-trimmer:1.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'org.aspectj:aspectjrt:1.8.5'
}
So, how to fix it?
Best Regards..
After a long head-pain I finally solved the problem. as you mentioned the reason is isoparser. so please add this to your build.gradle(Module:app)
compile('life.knowledge4:k4l-video-trimmer:1.1.3-SNAPSHOT') {
exclude group: 'com.googlecode.mp4parser', module: 'isoparser'
}
Problem solved! Happy coding :)

Execution failed for task ':app:transform' > duplicate entry: com/nineoldandroids/animation/Animator$AnimatorListener.class

I am getting this error while I try to run my Android Application,
I have used Reside Menu as merge into my Application (not by Gradle dependency) and then I am trying to integrate a payment gateway but while using a payment gateway I have to import ".aar" package.
After successfully importing, when I try to run my application at that time I got this error of library "nineoldandroids". I think this error triggered because one of the my gradle plugin is also using the same library.
Please take a look of my gradle :-
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:24.2.1'
compile project(':cal_library')
compile project(':mobicomkitui')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.droidninja:filepicker:2.0.3'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.leavjenn.smoothdaterangepicker:library:0.2.0'
compile 'com.github.skydoves:elasticviews:1.0.6'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.github.johnpersano:supertoasts:1.3.4#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
testCompile 'junit:junit:4.12'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
compile 'com.yalantis:ucrop:2.2.0'
compile 'com.onesignal:OneSignal:3.+#aar'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.j256.ormlite:ormlite-android:5.0'
compile 'com.j256.ormlite:ormlite-core:5.0'
compile 'com.github.kayvannj:PermissionUtils:1.0.2#aar'
}
So what could be the problem ?

Bundling gradle dependencies with aar

I have a project project A that has these dependencies:
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:palette-v7:24.0.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-plus:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.android.support:customtabs:24.0.0'
compile ('com.hannesdorfmann.smoothprogressbar:library:1.0.0'){
transitive = true
}
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'jp.wasabeef:blurry:2.0.2'
compile 'com.karumi:dexter:2.3.1'
compile 'io.card:android-sdk:5.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.cocosw:bottomsheet:1.+#aar'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'me.leolin:ShortcutBadger:1.1.3'
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.13.2'
compile 'xyz.danoz:recyclerviewfastscroller:0.1.3'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:multidex:1.0.1'
// compile 'joda-time:joda-time:2.9.3'
compile 'com.github.clans:fab:1.6.3'
compile files('libs/jsevaluator.jar')
compile files('libs/libphonenumber-7.0.2.jar')
compile project(':zoneOrchestra')
compile project(':scrambledkeyboard')
compile project(':datelibrary')
compile project(':phoneNumberValidator')
compile project(':library')
compile project(':inputtypepicker')
compile project(':pagerIndicator')
compile project(':persistentSearch')
compile('com.github.KingsMentor:IntentManip:v1.0.2') {
exclude group: 'com.android.support'
}
compile('com.twitter.sdk.android:tweet-composer:0.8.0#aar')
{
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
}
the project is bundle to project.aar , which should serve as a dependency to other projects.
The problem is, when project.aar is added to another project, it is unable to build. It requires it's dependencies which for some reasons are not bundled with it.
How do I make sure these dependencies are bundled along with the .aar file?

Categories

Resources