I get this error as soon as I enter the elasticsearch dependency,
compile 'org.elasticsearch.client:transport:5.0.0'
Detailed error logcat:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDevDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/io.netty.versions.properties
File1: C:\Users\Dell\.gradle\caches\modules-2\files-2.1\io.netty\netty-buffer\4.1.5.Final\b5fb6bccda4d63d4a74c9faccdf32f77ab66abc1\netty-buffer-4.1.5.Final.jar
File2: C:\Users\Dell\.gradle\caches\modules-2\files-2.1\io.netty\netty-handler\4.1.5.Final\6262900ee9487e62560030a136160df953b1cd6b\netty-handler-4.1.5.Final.jar
File3: C:\Users\Dell\.gradle\caches\modules-2\files-2.1\io.netty\netty-transport\4.1.5.Final\37126b370722ff9631ee13c91139aacec0a71d1d\netty-transport-4.1.5.Final.jar
File4: C:\Users\Dell\.gradle\caches\modules-2\files-2.1\io.netty\netty-codec-http\4.1.5.Final\87bda1b9ec7e3f75ca721fc87735cbedad2aa1a\netty-codec-http-4.1.5.Final.jar
File5: C:\Users\Dell\.gradle\caches\modules-2\files-2.1\io.netty\netty-resolver\4.1.5.Final\5f367bedcdc185a727fda3296b9a18014cdc22c4\netty-resolver-4.1.5.Final.jar
File6: C:\Users\Dell\.gradle\caches\modules-2\files-2.1\io.netty\netty-codec\4.1.5.Final\66bbf9324fa36467d041083f89328e2a24ec4f67\netty-codec-4.1.5.Final.jar
File7: C:\Users\Dell\.gradle\caches\modules-2\files-2.1\io.netty\netty-common\4.1.5.Final\607f8433d8782445e72abe34e43a7e57e86a5e6c\netty-common-4.1.5.Final.jar
Gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "..."
minSdkVersion 18
targetSdkVersion 25
versionCode 6
versionName "20170616.06"
multiDexEnabled true
ndk {
abiFilter "armeabi-v7a"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.release
}
}
productFlavors {
dev {
applicationId "..."
minSdkVersion 21
}
prod {
applicationId "..."
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
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'
}
lintOptions {
abortOnError false
}
}
repositories {
jcenter()
maven { url "https://dl.bintray.com/drummer-aidan/maven" }
mavenCentral()
}
configurations {
compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// https://mvnrepository.com/artifact/commons-io/commons-io
compile group: 'commons-io', name: 'commons-io', version: '2.4'
compile 'com.android.support:appcompat-v7:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:cardview-v7:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:recyclerview-v7:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:support-v4:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:design:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:percent:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:animated-vector-drawable:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:support-annotations:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:support-compat:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:support-core-ui:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:support-v13:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:support-v4:' + rootProject.ext.supportLibraryVersion'
compile 'com.google.firebase:firebase-storage:' + rootProject.ext.firebaseVersion
compile 'com.google.firebase:firebase-common:' + rootProject.ext.firebaseVersion
compile 'com.google.firebase:firebase-auth:' + rootProject.ext.firebaseVersion
compile 'com.google.firebase:firebase-database:' + rootProject.ext.firebaseVersion
compile 'com.google.firebase:firebase-crash:' + rootProject.ext.firebaseVersion
compile 'com.google.firebase:firebase-core:' + rootProject.ext.firebaseVersion
// this line must be included to integrate with Firebase
compile 'com.google.firebase:firebase-messaging:' + rootProject.ext.firebaseVersion
// this line must be included to use FCM
compile 'com.google.firebase:firebase-ads:' + rootProject.ext.firebaseVersion
compile 'com.google.android.gms:play-services-auth:' + rootProject.ext.firebaseVersion
compile 'com.google.android.gms:play-services-plus:' + rootProject.ext.firebaseVersion
compile 'com.google.android.gms:play-services-location:' + rootProject.ext.firebaseVersion
compile 'com.google.android.gms:play-services-places:' + rootProject.ext.firebaseVersion
compile "im.ene.toro2:toro-ext-exoplayer2:${toroVersion}"
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile 'com.jakewharton:butterknife:' + rootProject.ext.butterknifeVersion
apt 'com.jakewharton:butterknife-compiler:' + rootProject.ext.butterknifeVersion
//RxAndroid
compile 'io.reactivex:rxandroid:' + rootProject.ext.rxandroidVersion
compile 'io.reactivex:rxjava:' + rootProject.ext.rxjavaVersion
compile 'com.squareup.retrofit2:adapter-rxjava:' + rootProject.ext.retroRxAdapterVersion
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile 'com.google.firebase:firebase-invites:10.2.1'
compile 'com.firebase:firebase-client-android:2.5.2+'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:multidex:1.0.1'
compile 'pub.devrel:easypermissions:0.1.5'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
compile 'com.danikula:videocache:2.6.4'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.dinuscxj:circleprogressbar:1.1.1'
compile 'com.afollestad.material-dialogs:core:0.9.4.5'
compile 'com.afollestad:easyvideoplayer:0.3.0'
compile 'com.googlecode.mp4parser:isoparser:1.1.22'
compile 'javax.inject:javax.inject:1'
compile 'com.google.firebase:firebase-storage:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.api-client:google-api-client:1.21.0'
compile 'com.google.apis:google-api-services-people:v1-rev2-1.21.0'
compile 'org.elasticsearch.client:transport:5.0.0'
compile project(':ffmpeg4android_lib')
}
apply plugin: 'com.google.gms.google-services'
PS: There are a lot of similar posts already on SO, but none of them helped me
Can someone help me with this? Also, please tell me a generic way to solve these issues.
add the code below at the android section
packagingOptions {
pickFirst 'META-INF/*'
}
This github issue ticket suggests to use
packagingOptions {
pickFirst 'META-INF/INDEX.LIST'
pickFirst 'META-INF/LICENSE'
pickFirst 'META-INF/io.netty.versions.properties'
}
It is not advisable to use ElasticSearch directly into the android application. The cons of doing so are:
Anyone can decompile your application and get your ElasticSearch instance REST API link and play with your indexes the way they want and even modify them or delete them. The API link has to be publicly accessible for users to access.
There will be dependency conflicts like this question has, between Android SDK dependencies and ElasticSearch dependencies.
If you want to customize the way your requests are being built, you will have to release an update for the Application.
A better way to go about this is, make your own API to handle requests for your ElasticSearch Instance. From the App, make requests on that instance, that instance in turn makes a request on your ElasticSearch instance. When someone hits your API, you can get the variables for the search and build your own query. Pros of this method are:
Your ElasticSearch link can be private and nobody can delete your indexes.
You do not need to update the code for the Apps when you want to modify the way your queries are being built.
You do not get dependency conflicts.
Do not forget to put
packagingOptions {
pickFirst 'META-INF/*'
}
to all build gradle files if You use modules.
Related
each time I try to build an APK, this error keep showing !? I've tried almost all the soultoins mention on the site, but no luck!
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry: com/google/gson/annotations/Expose.class
My gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
lintOptions {
quiet true
abortOnError false
ignoreWarnings true
}
configurations {
all*.exclude group: 'commons-io'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'BinaryEncoder.java'
}
defaultConfig {
applicationId "com.xxxx.xxxxx"
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.2"
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
sourceSets {
main {
java {
exclude 'com.twilio:client-android:1.2.18.org.apache.http.lejacy.jar.org.apache.BinaryEncoder.java'
exclude 'org.apache.commons.codec.BinaryEncoder.java'
}
}
androidTest {
java {
exclude 'commons-codec-1.10/**'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.twilio:client-android:1.2.18') {
exclude group: 'org.apache.commons', module: 'commons-io'
}
compile project(':example')
compile project(':zoomcommonlib')
compile project(':zoommobilertc')
compile("com.github.hotchemi:permissionsdispatcher:2.4.0") {
exclude module: "support-v13"
}
compile('com.stripe:stripe-android:4.1.5') {
transitive = true;
exclude group: 'com.google.code.gson', module: 'gson'
}
compile('com.squareup.retrofit:retrofit:1.9.0') {
transitive = true;
exclude group: 'com.google.code.gson', module: 'gson'
}
compile 'com.google.android.gms:play-services-gcm:11.2.0'
compile 'lib.kingja.switchbutton:switchbutton:1.1.3'
compile 'com.orhanobut:hawk:2.0.1'
compile 'com.afollestad:material-camera:0.4.4'
compile 'com.werb.pickphotoview:pickphotoview:0.3.0'
compile 'com.github.Kennyc1012:BottomSheet:2.3.4'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.google.android.gms:play-services-identity:11.2.0'
compile 'com.google.android.gms:play-services-plus:11.2.0'
compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.paypal.sdk:paypal-android-sdk:2.14.4'
compile 'com.koushikdutta.ion:ion:2.1.8'
compile 'com.afollestad.material-dialogs:core:0.8.6.0'
compile 'com.amitshekhar.android:android-networking:1.0.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'
}
Here's some solutions that I've tried and did not work:
I've added those transitive = true; exclude group: 'com.google.code.gson', module: 'gson' forretrofitandstripe` dependencies
I deleted the gson dependency
I wanted to delete the jar file for gson library but I couldn't find it inside libs folder !?
multiDexEnabled true was already added and did no effect
I've deleted compile fileTree(dir: 'libs', include: ['*.jar'])
I think it has something to do with the Zoom module or with Stripe any help.. !?
You could try to get the dependency tree and figure out which package it is.
I figured it out, first.. thanks guys for ur help anyhow..! but I'm making this as the accepted answer since it's the one that worked out for me!
Step 1
I searched for the duplicated class in the whole project using (Double Shift)
and it showed me which library is also using the same class..! in my case it was zoommobilertc
Step 2
I tried excluding the gson module of that library like this:
compile project(':zoommobilertc'){
exclude group: 'com.google.code.gson', module: 'gson'
}
..but it didn't work, and it give me error that I think it has something to do with exclude . I tried a few solution but no luck!
So.. I did this instead ..
Open Project View
Open External Libraries
Find the library which's zoommobilertc and unfold its folder
Delete Gson jar file that shows.!
Step 3
After that, I synced the project and tried to build an apk, bu this error showed:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --multi-dex --main-dex-list E:\*****\*****\app\build\intermediates\multi-dex\debug\maindexlist.txt --output E:\*****\*****\app\build\intermediates\transforms\dex\debug\folders\1000\1f\main E:\*****\*****\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}
Then after searching I found a fix:
I added this inside build.gradle file within android section:
android{
//..
dexOptions {
javaMaxHeapSize "4g"
}
//..
}
..and this line inside local.properties file
org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m
Done
Find out the dependency that causes above Error and exclude gson
as follows from your dependency,
compile ('your_dependency'){
exclude group : 'com.google.code.gson'
}
In android studio terminal execute
./gradlew clean
and perform the following and rebuild
Try adding this to your dependencies
compile'com.android.support:multidex:1.0.1'
and in manifest add this
android:name="android.support.multidex.MultiDexApplication"
in the application tag
I had my gson.jar in my libs folder.
I fixed my duplicate entries by retaining the line below:
implementation fileTree(dir: "libs", include: ["*.jar"])
And deleting this entry here:
implementation 'com.google.code.gson:gson:2.8.7'
Spent almost a day searching the issue but no luck.Its due to the redundancy of dependencies.Which one is repeated couldn't find yet.
here in my build.gradle file
apply plugin: 'com.android.application'
android {
defaultConfig {
applicationId "com.ujjwalmainali.univhub"
minSdkVersion 16
targetSdkVersion 22
versionCode 8
versionName "1.1"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ECLIPSE_.SF'
exclude 'META-INF/ECLIPSE_.RSA'
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK-
Android/master/" }
}
dependencies {
testCompile 'junit:junit:4.12'
//iconify dependencies
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2' // (v4.5)
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.sendbird.sdk:sendbird-android-sdk:3.0.25'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
compile 'net.gotev:uploadservice-okhttp:3.0.3'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.nononsenseapps:filepicker:4.1.0'
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.0'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'io.github.kobakei:ratethisapp:1.2.0'
compile 'com.github.paolorotolo:appintro:4.1.0'
//webview
compile 'com.thefinestartist:finestwebview:1.2.7'
//for android drawer
compile('com.mikepenz:materialdrawer:5.8.1#aar') {
transitive = true
}
compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.10.4#aar'){
transitive=true
}
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.googlecode.json-simple:json-simple:1.1'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1#aar'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-messaging:9.2.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'commons-validator:commons-validator:1.4.1'
//for the calender date picker supports other type picker also like radial time picker,recurrence picker
compile 'com.code-troopers.betterpickers:library:3.1.0'
compile 'com.mikepenz:actionitembadge:3.3.1#aar'
compile 'com.mobsandgeeks:android-saripaar:2.0.1'
compile 'com.nightonke:boommenu:2.0.9'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.google.android.gms:play-services-places:9.2.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
//circular progress bar
compile 'com.victor:lib:1.0.4'
//app crash report
compile 'ch.acra:acra:4.9.0'
ext.googlePlayServicesVersion='10.0.1'
ext.supportLibraryVersion='23.1.1'
provided 'org.glassfish:javax.annotation:10.0-b28'
apply plugin: 'com.google.gms.google-services'
}
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/commons/collections/ArrayStack.class
compile 'commons-validator:commons-validator:1.4.1'
The commons-validator dependency contains two versions of ArrayStack, because of a transitive dependency it has on commons-collections.
By excluding commons-collections in the declaration, you're effectively removing all classes associated with that library and what remains is only one ArrayStack class at runtime.
compile('commons-validator:commons-validator:1.4.1') {
exclude module: 'commons-collections'
}
In my case following solution work for me:
Just added in myProject/app/build.gradle inside android{}
configurations {
all*.exclude group: 'commons-collections', module: 'commons-collections'
}
And then: Sync -> Clean -> Rebuild, Project
I am trying to build my app on android studio virtual simulator, I have successfully tested on api level 21 and above now I am testing lower level api 19, but whenever I run i will get this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/volley/Request$Priority.class
This is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'dev.dworks.libs:volleyplus:0.1.4'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.android.support:design:25.1.0'
compile 'com.roughike:bottom-bar:1.2.1'
compile 'com.ncapdevi:frag-nav:1.2.2'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'net.gotev:uploadservice:3.0.3'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.journeyapps:zxing-android-embedded:3.4.0'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1#aar'
compile 'com.hedgehog.ratingbar:app:1.1.2'
testCompile 'junit:junit:4.12'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
}
apply plugin: 'com.google.gms.google-services'
I have found many solution online regarding this but not specifically to this issue, I believe the problem is with volley, but I cannot remove any library due to my code. How should I solve this issue? Thank you!
You are using 2 different versions of volley libraries
compile 'com.android.volley:volley:1.0.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
use any one of the above
and I dont know about
compile 'dev.dworks.libs:volleyplus:0.1.4'
If that is similar library to above two ,the error will still remain
I started a project which needed the Apache POI library. I pasted them in my build.gradle file and everything seemed fine. Until I build the debug app.
I am getting the following error:
Error:Execution failed for task
':mobile:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
org/apache/xmlbeans/xml/stream/Location.class
I have tried removing and adding exclude group and module, but nothing has helped. When I do get the debug apk to build, and run the app, the app crashes because org.apache.xmlbeans.XmlOptions is not found when opening a DOCX file. The DOC files work fine.
Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "{application_id}"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
encoding "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
// set to true to turn off analysis progress reporting by lint
quiet false
// if true, stop the gradle build if errors are found
abortOnError true
// if true, only report errors
ignoreWarnings false
// turn off checking the given issue id's
disable 'TypographyFractions', 'TypographyQuotes'
// if true, generate a text report of issues (false by default)
textReport true
// location to write the output; can be a file or 'stdout'
textOutput 'stdout'
// if true, generate an HTML report (with issue explanations, sourcecode, etc)
htmlReport true
// optional path to report (default will be lint-results.html in the builddir)
htmlOutput file("lint-report.html")
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/services/org.apache.sis.storage.DataStoreProvider'
exclude 'META-INF/BCKEY.SF'
exclude 'META-INF/spring.handlers'
exclude 'META-INF/spring.schemas'
exclude 'META-INF/services/org.apache.tika.detect.Detector'
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/services/org.apache.sis.internal.jaxb.TypeRegistration'
exclude 'META-INF/services/org.apache.tika.parser.Parser'
exclude 'META-INF/cxf/bus-extensions.txt'
}
}
repositories{
mavenCentral()
maven {url "https://github.com/karussell/mvnrepo/raw/master/releases"}
maven {url "http://dl.bintray.com/lukaville/maven"}
maven {url "http://dl.bintray.com/dasar/maven"}
}
configurations {
all*.exclude group: 'ch.qos.logback'
all*.exclude group: 'org.slf4j', module: 'jcl-over-slf4j'
all*.exclude group: 'org.slf4j', module: 'jul-to-slf4j'
all*.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
all*.exclude group: 'org.slf4j', module: 'jcl-over-slf4j'
all*.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
all*.exclude group: 'org.slf4j', module: 'slf4j-simple'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-annotations:23.1.1'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile ('org.slf4j:slf4j-android:1.7.13'){
exclude group: 'net.sf.log4jdbc'
exclude group: 'org.slf4j.logger'
}
compile 'org.jsoup:jsoup:1.7.3'
compile 'de.jetwick:snacktory:1.1'
compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
// The material design file browser library
compile 'com.nbsp:library:1.02'
// Epub library
compile 'nl.siegmann.epublib:epub-core:1.0#aar'
// Begin for Office documents dependencies
compile 'org.apache.xmlbeans:xmlbeans:2.6.0'
compile ('org.apache.poi:poi:3.13'){
transitive = false
exclude group: 'org.apache.xmlbeans'
exclude module: 'org.apache.xmlbeans'
}
compile ('org.apache.poi:poi-ooxml:3.13'){
transitive = false
exclude group: 'org.apache.xmlbeans'
exclude module: 'org.apache.xmlbeans'
}
compile ('org.apache.poi:poi-scratchpad:3.13'){
transitive = false
exclude group: 'org.apache.xmlbeans'
exclude module: 'org.apache.xmlbeans'
}
compile ('org.apache.tika:tika-core:1.11'){
transitive = false
exclude group: 'org.apache.xmlbeans'
}
compile ('org.apache.tika:tika-parsers:1.11'){
transitive = false
exclude group: 'org.apache.xmlbeans'
exclude module: 'org.apache.xmlbeans'
}
// End for Office documents dependencies
// PDF document library
compile 'com.itextpdf:itextpdf:5.5.8'
}
I have checked if there are any other dependencies using the org.apache.xmlbeans dependency, but I haven't found one.
If anybody would have a solution, please feel free to answer the question, but I would appreciate it if you tell us how you come to the answer.
Tim
EDIT:
When executing this command:
gradlew -q dependencies mobile:dependencies --configuration compile
(output here: http://pastebin.com/7TugFR3J)
The org.apache.xmlbeans dependency is only listed once. Might there be a problem relating to any default java component?
EDIT NO.2:
I found that Java has a component like this: javax/xml/stream/Location.class
So I think I need to remove it from the build, but I don't know how.
You can try something like this.
Unzip the jar file. (Simply change .jar extension to .zip
This will remove the duplicate files.
Recreate the jar using jar cf xmlbeans.jar -C (path to unzipped folder) . (Mind it, there is a dot in the end of command)
Use this regenerated jar
I'm starting to get crazy with the error I'm getting in Android Studio when importing all jackson dependencies.
This app is working just fine in Eclipse with ADT (is a old app, with old dependencies), but I decided to migrate it because when I'm trying to use Parse, there was some errors I wasn't able to resolve quickly.
Here is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.racsa.oncecincocinco"
minSdkVersion 15
targetSdkVersion 22
}
android {
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'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':library')
compile project(':facebookSDK')
compile fileTree(dir: 'libs')
// parse
//compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.android.gms:play-services:5.0.89'
/*
compile files('libs/augmentrealityframework.jar')
compile files('libs/commons-codec-1.5.jar')
compile files('libs/commons-io-1.3.2.jar')
compile files('libs/commons-lang3-3.1.jar')
compile files('libs/robospice-1.4.6.jar')
compile files('libs/robospice-cache-1.4.6.jar')
compile files('libs/robospice-spring-android-1.4.6.jar')
compile files('libs/simple-xml-2.7.1.jar')
compile files('libs/spring-android-core-1.0.1.RELEASE.jar')
compile files('libs/spring-android-rest-template-1.0.1.RELEASE.jar')
compile files('libs/twitter4j-core-4.0.2.jar')
compile files('libs/twitter4j-media-support-4.0.2.jar')*/
}
I know there's no dependencies saying jackson, that's because I have them physically in my /libs folder, but I get java exited with non zero value 2(I have red about this, and its basically because there's a double reference to a library) and I just can't find where and which library is called twice.
Here is my /libs folder:
Thanks in advance
I was able to resolve this the "hard way" by changing RoboSpice and Jackson for Asynctask. Now the app is faster (don't ask me why, 'cause I don't know) and working perfectly in Android Studio.
In the end, my gradle file looks like this:
dependencies {
compile project(':library')
compile project(':facebookSDK')
compile fileTree(dir: 'libs')
// parse
//compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.android.gms:play-services:5.0.89'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.6.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.0'
}
And my /libs folder is the same, but without all the jackson dependencies. Thanks anyway!