2014-06-12 75 views
-1

我在我的項目中添加ViewPagerIndicator庫。但卡住了這個問題:意外的頂級例外[Android Studio]

這裏是問題

 Error:Execution failed for task ':pay:dexDebug'. 
    com.android.ide.common.internal.LoggedErrorException: Failed to run command: 
     /Documents/sdk/build-tools/19.1.0/dx --dex --num-threads=4 --output 
../build/intermediates/dex/debug 
../build/intermediates/classes/debug 
../build/intermediates/dependency-cache/debug 
../build/intermediates/pre-dexed/debug/butterknife-4.0.1-f7e234af31748238bde435dc44314700fd06e850.jar 
../build/intermediates/pre-dexed/debug/classes-8fe1b2ffe2359cd86de26b16b85db4b41a42d220.jar 
../build/intermediates/pre-dexed/debug/classes-f581d0cc66f4aeea4b71b96196fc37f7519c197a.jar 
../build/intermediates/pre-dexed/debug/library-2.4.1-9b63b9ebec4cf7cad28ee4701dc08c2d6b0ee55d.jar 
../build/intermediates/pre-dexed/debug/support-v4-19.1.0-e23f6fd20435425326ace2bf395d0471ff3c0c91.jar 
../build/intermediates/pre-dexed/debug/support-v4-r7-6ea93b73eed4a89fbd04d757993df085d37a4142.jar 
     Error Code: 
     2 
     Output: 
     UNEXPECTED TOP-LEVEL EXCEPTION: 
     com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; 
      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) 

這裏的日誌是我的項目的生成文件:

android { 
    compileSdkVersion 19 
    buildToolsVersion '19.1.0' 
    defaultConfig { 
     applicationId 'com.android.temp' 
     minSdkVersion 10 
     targetSdkVersion 19 
     versionCode 1 
     versionName '1.0' 
    } 
    buildTypes { 
     release { 
      runProguard false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    productFlavors { 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.viewpagerindicator:library:2.4.1' 
    compile 'com.jakewharton:butterknife:4.0.+' 
    compile project(':view_pager_indicator') 
    compile 'com.android.support:support-v4:+' 
    compile 'com.android.support:appcompat-v7:+' 
} 

這裏是構建圖書館項目文件:

android { 
    compileSdkVersion 19 
    buildToolsVersion "19.1" 

    defaultConfig { 
     minSdkVersion 8 
     targetSdkVersion 16 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      runProguard false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 
} 


dependencies { 
    compile 'com.android.support:appcompat-v7:19.+' 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
} 

請幫我,我錯了。 我已經搜索並嘗試了其他解決方案,但沒有一個爲我工作。

+0

在v4支持庫中有許多涉及「Multiple dex files define」錯誤的SO問題/回答:http://stackoverflow.com/search?q=%5Bandroid-studio%5D+or+%5Bandroid-gradle %5D + multiple + dex +文件你應該解釋你的情況與這些不同。 –

回答

1

發現我的錯誤:

我已經添加了兩個依賴於相同的庫項目即ViewPagerIndicator

compile 'com.viewpagerindicator:library:2.4.1' 
.. 

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

刪除它的一個解決我的問題。

相關問題