Autore Topic: com.android.dex.DexException Aiuto !  (Letto 1778 volte)

Offline Caco85

  • Nuovo arrivato
  • *
  • Post: 15
  • Respect: 0
    • Mostra profilo
  • Dispositivo Android:
    Motorola moto g
  • Sistema operativo:
    Windows 7
com.android.dex.DexException Aiuto !
« il: 19 Agosto 2014, 09:24:33 CEST »
0
Lanciando la mia app ottengo questo errore:
Posto la gradle console:
Codice: [Seleziona]
Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature.
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild
:app:compileDebugNdk
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComActionbarsherlockActionbarsherlock440Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices4030Library UP-TO-DATE
:app:prepareComLarswerkmanHoloColorPicker14Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/common/annotations/Beta;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
        at com.android.dx.command.dexer.Main.run(Main.java:230)
        at com.android.dx.command.dexer.Main.main(Main.java:199)
        at com.android.dx.command.Main.main(Main.java:103)


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
        C:\Program Files (x86)\sdk\build-tools\20.0.0\dx.bat --dex --num-threads=4 --output C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\dex\debug C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\classes\debug C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\dependency-cache\debug C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\classes-a834b7f2f63b5486e701b33460fc900912328fbd.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\classes-af5305c0093050392f8a4473c2b45a40c897fd2e.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\classes-cb9608f4d12aa22da5e1b757d136c1b8a2147988.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\google-api-client-1.19.0-f45f4047a0f8bc642b87ff7c17e9559339d89ae2.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\google-api-client-android-1.19.0-0ff48a75cc557ab07186963c150d1cb370e8b4a3.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\google-http-client-1.19.0-187a09cf885344fd7c795df4113a4c481d2a999b.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\google-http-client-android-1.19.0-c2828d8a65d08190362b0126751b7a93cefdc2a2.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\google-http-client-gson-1.19.0-3af0278eeaad65cf4edb58b5f39a1fa6de2644ca.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\google-http-client-jackson2-1.19.0-e5af8fca6605e11b01f2fbd37d84c44e637270ee.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\google-oauth-client-1.19.0-2be3c4b0daaeb6a3a448747671a9aafc868a3d7b.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\gson-2.1-ca6821484d3c717277d21b1899a7672d958630ac.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\guava-14.0.1-4d467c5e227386a473eb59c9163ae3c804f3cf4e.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\guava-jdk5-13.0-770b34e9759fde2127a834fc9989be4b5167a607.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\jackson-core-2.1.3-f2321e255e5c399d47ecc3d4b1bc432d2105f3d5.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\jsr305-1.3.9-bb5121130379361c6296162b8ec0f3455d886c45.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\sand-v1-1.19.0-SNAPSHOT-25eca97b661e19741bdc8a584ec5361529a8fd7f.jar C:\Users\Caco\AndroidStudioProjects\Sand\app\build\intermediates\pre-dexed\debug\support-v4-19.0.1-78d9b98947df31bd04400063d36c9dea1c332899.jar
Error Code:
        2
Output:
       
        UNEXPECTED TOP-LEVEL EXCEPTION:
        com.android.dex.DexException: Multiple dex files define Lcom/google/common/annotations/Beta;
                at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
                at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
                at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
                at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
                at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
                at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
                at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
                at com.android.dx.command.dexer.Main.run(Main.java:230)
                at com.android.dx.command.dexer.Main.main(Main.java:199)
                at com.android.dx.command.Main.main(Main.java:103)
       


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 48.518 secs
Questo è il build.gradle
Codice: [Seleziona]
apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'
    defaultConfig {
        applicationId '*******************t'
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

repositories {
    maven { url 'http://google-api-client-libraries.appspot.com/mavenrepo' }
    mavenCentral()
    mavenLocal()
}

dependencies {
    compile 'com.android.support:support-v4:19.0.+'
    // BEGIN Google APIs
    // Play Services will validate the application prior to allowing OAuth2 access.
    compile(group: 'com.google.android.gms', name: 'play-services', version: '4.0.30')
    // The following lines implement maven imports as defined at:
    // https://code.google.com/p/google-api-java-client/wiki/Setup
    // Add the Google API client library.
    compile(group: 'com.google.api-client', name: 'google-api-client', version: '1.17.0-rc') {
        // Exclude artifacts that the Android SDK/Runtime provides.
        exclude(group: 'xpp3', module: 'xpp3')
        exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
        exclude(group: 'junit', module: 'junit')
        exclude(group: 'com.google.android', module: 'android')
    }
    // Add the Android extensions for the Google API client library.
    // This will automatically include play services as long as you have download that library
    // from the Android SDK manager.
    // Add the Android extensions for the Google API client library.
    compile(group: 'com.google.api-client', name: 'google-api-client-android',
                version: '1.19.0')
                {
                    // Exclude play services, since we're not using this yet.
                    exclude(group: 'com.google.android.google-play-services', module: 'google-play-services')
                }
    // END Google APIs
    // The following client libraries make HTTP/JSON on Android easier.
    // Android extensions for Google HTTP Client.
    compile(group: 'com.google.http-client', name: 'google-http-client-android',
            version: '1.17.0-rc') {
        exclude(group: 'com.google.android', module: 'android')
    }
    compile 'com.google.http-client:google-http-client-gson:1.19.0'  //questa riga produce l'errore
    // This is used by the Google HTTP client library.
    compile(group: 'com.google.guava', name: 'guava', version: '14.0.+')
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.larswerkman:HoloColorPicker:1.4'
    compile files('libs/sand-v1-1.19.0-SNAPSHOT.jar')
}

Ho cercato su internet ma non sono riuscito a risolvere il problema.
Conto su di voi!

Post unito: [time]19 Agosto 2014, 10:08:35 CEST[/time]
Ho risolto utillizzando la stessa versione delle dependency di google in questo modo:
Codice: [Seleziona]
apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'
    defaultConfig {
        applicationId 'it.**************t'
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

repositories {
    maven { url 'http://google-api-client-libraries.appspot.com/mavenrepo' }
    mavenCentral()
    mavenLocal()
}

dependencies {

    compile 'com.android.support:support-v4:19.0.+'

    compile(group: 'com.google.android.gms', name: 'play-services', version: '4.0.30')

    compile(group: 'com.google.api-client', name: 'google-api-client', version: '1.17.0-rc') {
        exclude(group: 'xpp3', module: 'xpp3')
        exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
        exclude(group: 'junit', module: 'junit')
        exclude(group: 'com.google.android', module: 'android')
    }

    compile(group: 'com.google.api-client', name: 'google-api-client-android',
                version: '1.17.0-rc')
                {
                    exclude(group: 'com.google.android.google-play-services', module: 'google-play-services')
                }

    compile(group: 'com.google.http-client', name: 'google-http-client-android',
            version: '1.17.0-rc') {
        exclude(group: 'com.google.android', module: 'android')
    }

    compile 'com.google.http-client:google-http-client-gson:1.17.0-rc'

    compile(group: 'com.google.guava', name: 'guava', version: '14.0.+')
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.larswerkman:HoloColorPicker:1.4'
    compile files('libs/sand-v1-1.19.0-SNAPSHOT.jar')
}
« Ultima modifica: 19 Agosto 2014, 10:09:10 CEST da Caco85 »