2014-12-29 105 views
0

今天我遷移到Android Studio 1.1並開始更新某些庫的版本。當我使用gradle按鈕構建項目時,一切看起來都正常,但是當我嘗試運行該應用程序時,我在gradle控制檯中輸入了錯誤消息,您可以在帖子末尾看到該錯誤消息。對於我而言,錯誤消息很明顯,有些庫在內部使用了一些在我的依賴項之間常見的庫,它們可能有不同的版本。有人知道我該如何發現哪些庫存在衝突,以及如何解決這個問題(我無法從項目中刪除任何庫)。下面你可以在我的項目中找到構建文件的抽象。感謝提前:)Android Studio&Gradle:多個dex文件

項目的gradle這個文件:

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.0.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

應用程序的(主模塊)gradle這個文件

buildscript { 
    repositories { 
    maven { url 'http://download.crashlytics.com/maven' } 
    } 

    dependencies { 
    classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'crashlytics' 

repositories { 
    mavenCentral() 
    maven { url 'http://download.crashlytics.com/maven' } 
} 

android { 
    compileSdkVersion 19 
    buildToolsVersion '19.1.0' 
    defaultConfig { 
    applicationId 'com.myapp' 
    minSdkVersion 16 
    targetSdkVersion 19 
    versionCode 1 
    versionName '1.0.0' 
    } 
    buildTypes { 
    debug { 
     debuggable true 
    } 
    release { 
     debuggable false 
    } 
    } 
    dexOptions { 
    preDexLibraries = false 
    } 
    lintOptions { 
    checkReleaseBuilds false 
    abortOnError false 
    } 
} 

dependencies { 
    compile project(':facebook') 
    compile 'com.crashlytics.android:crashlytics:1.+' 
    compile 'com.jakewharton:butterknife:6.0.0' 
    compile 'com.squareup:otto:1.3.5' 
    compile 'com.squareup.picasso:picasso:2.4.0' 
    compile 'com.squareup.retrofit:retrofit:1.8.0' 
    compile 'com.squareup.okhttp:okhttp:2.1.0' 
    compile 'com.squareup.okhttp:okhttp-urlconnection:1.6.0' 
    compile 'com.path:android-priority-jobqueue:1.1.2' 

    compile 'com.google.android.gms:play-services-base:6.5.87' // Analytics, GCM 
    compile 'com.google.android.gms:play-services-maps:6.5.87' 
    compile 'com.google.android.gms:play-services-location:6.5.87' 
    compile 'com.android.support:support-v13:21.0.0' 
} 

搖籃控制檯輸出:

Error:Class android.support.v4.util.TimeUtils has already been added to output. Please remove duplicate copies. 
1 error; aborting 
Error:Execution failed for task ':app:dexDebug'. 
> com.android.ide.common.internal.LoggedErrorException: Failed to run command: 
    /Users/MyMAC/Documents/Development/IDE's/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.1.0/dx --dex --no-optimize ......... 
    Error Code: 
    1 
    Output: 
    UNEXPECTED TOP-LEVEL EXCEPTION: 
    java.lang.IllegalArgumentException: already added: Landroid/support/v4/util/TimeUtils; 
     at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122) 
     at com.android.dx.dex.file.DexFile.add(DexFile.java:161) 
     at com.android.dx.command.dexer.Main.processClass(Main.java:685) 
     at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634) 
     at com.android.dx.command.dexer.Main.access$600(Main.java:78) 
     at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572) 
     at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) 
     at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) 
     at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) 
     at com.android.dx.command.dexer.Main.processOne(Main.java:596) 
     at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) 
     at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) 
     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) 
    1 error; aborting 
Information:BUILD FAILED 

回答

2

刪除Android的支持-v4 in libs文件夾中facebook proj或您的應用程序模塊

+0

太棒了!這是問題....非常感謝你的隊友! :D – Androider

+0

歡迎您))) – SorryForMyEnglish

相關問題