2

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..

Community
  • 1
  • 1
Alex Fillips
  • 391
  • 1
  • 3
  • 8

2 Answers2

1

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'
Alex Fillips
  • 391
  • 1
  • 3
  • 8
0

Try:

project > clean

project > rebuild

and run again

Mou
  • 2,027
  • 1
  • 18
  • 29
  • already tried this, project rebuild works, but it throws the same error on run. – Alex Fillips Dec 13 '14 at 12:29
  • Try to remove all generated directories (build, bin, etc...) and clean & rebuild again. If this do not work, you have to search which libraries have this class and exclude one. – Mou Dec 13 '14 at 12:41
  • Thanks for your help, compile 'net.sf.json-lib:json-lib:2.4:jdk15' is causing the problem. if i remove this (and remove my java-files) it runs without error. the json-lib also has org.apache.commons.collections, see at http://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4. So how do i exlude it in build.gradle? – Alex Fillips Dec 13 '14 at 13:28
  • this works but now my app is crashing on runtime. :-( compile ('net.sf.json-lib:json-lib:2.4:jdk15') { exclude group: "commons-collections", module: "commons-collections" } – Alex Fillips Dec 13 '14 at 14:08