Bundling gradle dependencies with aar - android

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?

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')

Android project building failed with `TransformException`

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'
}

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 ?

Android speed-up application when we use multi library on Gradle

I'm using multi library which they are installed by Gradle on my appliaction, after opening application each time i get simple delay on opening application such as 10 second :| if i download libraries instead of using and installing by Gradle, that cause of speed up my application or not?
My Gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-design:0.4.0'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'frankiesardo:icepick:3.2.0'
provided 'frankiesardo:icepick-processor:3.2.0'
compile('io.socket:socket.io-client:0.7.0') {
exclude group: "org.json", module: "json"
}
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.devlight.navigationtabbar:library:+'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.github.chyrta:AndroidOnboarder:+'
compile 'com.github.lamydev:android-notification:3.0'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.bugsnag:bugsnag-android:+'
compile 'com.github.liuguangqiang.swipeback:library:1.0.2#aar'
compile 'com.wunderlist:sliding-layer:1.2.5'
compile 'com.facebook.rebound:rebound:0.3.8'
compile 'com.tumblr:backboard:0.1.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.jaredrummler:android-device-names:1.0.9'
compile 'org.sufficientlysecure:html-textview:1.6'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
compile 'com.kogitune:pre-lollipop-activity-transition:1.3.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.alexvasilkov:foldable-layout:1.2.0'
compile 'com.mikhaellopez:circularfillableloaders:1.2.0'
compile 'cat.ereza:customactivityoncrash:1.5.0'
compile 'jp.wasabeef:glide-transformations:2.0.1'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.3'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.3'
compile 'com.github.goka.flickableview:flickableview:1.0.0'
compile 'com.github.Kennyc1012:BottomSheet:2.1.2'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile('com.github.ozodrukh:CircularReveal:2.0.1#aar') {
transitive = true;
}
compile project(':lib-searchview')
}
No because gradle saves them locally, you can go to your gradle.properties and set these values and enable the gradle to use more of your machine compute power.
-Xms4096m
-Xmx4096m
-XX:MaxPermSize=2048m
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
-XX:+HeapDumpOnOutOfMemoryError
-Dfile.encoding=utf-8

Categories

Resources