I'm trying to import https://github.com/Kickflip/kickflip-android-sdk using gradle into my android build and I'm getting :
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/codec/binary/Base64;
Commons.codec is a dependency of my project, but not directly of the kick-flip project, I think its coming from one of the jars included there. I can see the .class files if I open Kickflip's classes.jar.
How can I exclude Base64.class from being imported from kickflip into the final build? I've looked at using ziptree to exclude things but haven't been able to get anything to work.
Thanks
My build.gradle is:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
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'
exclude 'META-INF/ASL2.0'
}
android.applicationVariants.all{ variant ->
// This is an annoying hack to get around the fact that the Gradle plugin does not support
// having libraries with different minSdkVersions. Play Services has a min version of 9 (Gingerbread)
// but Android Maps Utils supports 8 (Froyo) still
variant.processManifest.doFirst {
File manifestFile = file("${buildDir}/exploded-aar/io.kickflip/sdk/0.9.9/AndroidManifest.xml")
if (manifestFile.exists()) {
println("Replacing minSdkVersion in Android Maps Utils")
String content = manifestFile.getText('UTF-8')
content = content.replaceAll(/minSdkVersion="18"/, 'minSdkVersion=\"10\"')
manifestFile.write(content, 'UTF-8')
println(content)
}
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'io.kickflip:sdk:0.9.9'
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':libs:typeface-textview:library')
compile project(':libs:gpuimage')
compile 'com.google.android.gms:play-services:4.3.23'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.koushikdutta.urlimageviewhelper:urlimageviewhelper:1.0.4'
compile ('fr.avianey:facebook-android-api:3.14.0') {
exclude module: 'support-v4'
}
compile 'com.github.japgolly.android:svg-android:2.0.1'
compile 'org.scribe:scribe:1.3.5'
compile 'commons-codec:commons-codec:1.8'
}
Probably the problem is Base64 class included twice. It is in the 'google-http-client' (view it). Try to exclude this class. If you're lucky, being an Util class, it isn't used in the code.
Try this in your build.gradle:
package com.google.api.client.util;
sourceSets {
main {
java {
exclude 'com.google.api.client.util.Base64.java'
exclude 'org.apache.commons.codec.binary.Base64.java'
}
}
}
NOTE: I don't tried it yet, but sounds as a possibility
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 have written a small code, but whenever I try to build the apk, I get the following error:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.multidex.ClassReferenceListBuilder with arguments {C:\Users\xxxx\Desktop\yyyyy\app\build\intermediates\multi-dex\debug\componentClasses.jar C:\Users\xxxx\Desktop\yyyyy\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}
Where xxxx is my username, and yyyyy is project name.
I have tried all possible solutions that I found on Stack Overflow, but I realized that all of them were asked about older versions.
I have the latest version of Android Studio. I am using latest version of Android SDK, the build tools, gradle, JDK 8.0 , and JRE 7. I also tried JRE 8.
build.gradle(module app) :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "xxxx.yyyyy"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "Unreleased Demo Version"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
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.pro'
}
}
}
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.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
}
In you build.gradle/app
defaultConfig {
....
//Add this line
multiDexEnabled true
}
dependencies {
....
//Add this line
compile 'com.android.support:multidex:1.0.0'
}
This happens as the Android platform has continued to grow, so has the size of Android apps. When your app and the libraries it references reach a certain size, you encounter build errors that indicate your app has reached a limit of the Android app build architecture
Modify the module-level build.gradle file to enable multidex and add the multidex library as a dependency, as shown here: Source
android {
defaultConfig {
multiDexEnabled true
}
}
Try this in Module:App gradle folder.
multiDexEnabled true
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'
}
I found there is no need to install JDK and JRE (ref:android studio 2.3.2 latest download page under system requirements)
And there is a folder named "jre" in programfiles/android-studio.
So I thought I shall uninstall JDK and JRE (as the problem related to java)
After this I reinstalled android studio.
And now it works fine.
(I haven't done research in deep although it helped me)
You have not shared any of your codes and dependencies you working with ,so it is difficult to guess exact problem.
but from error you posted ,i think your program cross the limit of 64K Methods.
Apk files conatins bytecode files in the form of DEX, and it has a limit of 65,536 methods in a single DEX file.
So if your App has more then 64k methods ,you should go for multiple Dex files.
Enabling mutiple Dex ,means app build process will generate more than one DEX file
defaultConfig {
....
multiDexEnabled true
}
dependencies {
....
compile 'com.android.support:multidex:1.0.0'
}
This happen when your have cross 65,536 method reference limit.
Step 1
You can add the following to your app's build.gradle file
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
Step 2A
After that you have to extend the Application class in the following way
public class MyApplication extends SomeOtherApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Or you can do as below:
Step 2B
public class MyApplication extends MultiDexApplication { ... }
STEP 3
Finally update your manifest file like below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
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!
I am still using Android Studio 0.8.9 on my Macbook Air. On my iMac i installed Android Studio 1.0.
As 1.0 only supports 'com.android.tools.build:gradle:1.0.0' i had to change my build.gradles
as mentioned here. Gradle DSL method not found: 'runProguard'
0.8.9 uses 'com.android.tools.build:gradle:0.12.2'
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example...."
minSdkVersion 19
targetSdkVersion 20
versionCode 1
versionName "0.87"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
dexOptions {
preDexLibraries = false
} }
repositories {
mavenCentral()
flatDir {
dirs 'libs'
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.spotify.sdk:spotifysdk:1.0.0-beta6#aar'
compile('se.michaelthelin.spotify:spotify-web-api-java:1.4.20')
}
With the 0.8.9 beta on my MacBook Air my App builds fine. On my iMac i get this error.
org.apache.commons.collections.ArrayStack has already been added to output. Please remove duplicate copies.
UPDATE
The problems seems to be that commons-collections is added to the external libraries and commons-beanutils which also includes a commons-collections.
compile('se.michaelthelin.spotify:spotify-web-api-java:1.4.20') {
exclude group: "commons-beanutils", module: "commons-beanutils"
}
if i exclude the commons-beanutils the build process is fine, but the app crashes, as it needs the commons-beanutils. same if i exclude the commons-collections.
furthermore i tried to manually remove the folder common-collections from the commons-beanutils jar, but this also does not work..
finally it works.
this one does not include commons-collections, so everything works fine.
compile 'commons-beanutils:commons-beanutils:20030211.134440'
don't understand why this was not necessary in beta 0.8.9
compile('se.michaelthelin.spotify:spotify-web-api-java:1.4.20') {
exclude group: "commons-beanutils", module: "commons-beanutils"
}
compile 'commons-beanutils:commons-beanutils:20030211.134440'
Try:
project > clean
project > rebuild
and run again