2015-10-07 108 views
0

更新到Android Studio 1.4後,IDE要求更新到最新的插件和sdk,下載的內容大約爲1.2 Gb,所以我更新了並在創建項目I時得到這個錯誤:更新到Android Studio 1.4和最新的SDK後構建失敗

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:assembleDebug] 
    :app:preBuild UP-TO-DATE 
    :app:preDebugBuild UP-TO-DATE 
    :app:checkDebugManifest 
    :app:preReleaseBuild UP-TO-DATE 
    :app:prepareComAndroidSupportAppcompatV72221Library UP-TO-DATE 
    :app:prepareComAndroidSupportCardviewV72103Library UP-TO-DATE 
    :app:prepareComAndroidSupportDesign2221Library UP-TO-DATE 
    :app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE 
    :app:prepareComAndroidSupportPaletteV72103Library UP-TO-DATE 
    :app:prepareComAndroidSupportRecyclerviewV72103Library UP-TO-DATE 
    :app:prepareComAndroidSupportSupportV42221Library UP-TO-DATE 
    :app:prepareComBalysvMaterialRipple102Library UP-TO-DATE 
    :app:prepareComBalysvMaterialmenuMaterialMenu154Library UP-TO-DATE 
    :app:prepareComBalysvMaterialmenuMaterialMenuToolbar154Library UP-TO-DATE 
    :app:prepareComDaimajiaAndroidanimationsLibrary113Library UP-TO-DATE 
    :app:prepareComDaimajiaEasingLibrary101Library UP-TO-DATE 
    :app:prepareComDaimajiaSliderLibrary115Library UP-TO-DATE 
    :app:prepareComEtsyAndroidGridLibrary105Library UP-TO-DATE 
    :app:prepareComGithubAmlcurranShowcaseviewLibrary500Library UP-TO-DATE 
    :app:prepareComGithubAsylAnimationArcanimator100Library UP-TO-DATE 
    :app:prepareComGithubCastorflexSmoothprogressbarLibrary110Library UP-TO-DATE 
    :app:prepareComGithubCastorflexSmoothprogressbarLibraryCircular110Library UP-TO-DATE 
    :app:prepareComGithubPwittchenPrefser105Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServices810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesAppinvite810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesAppstate810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesBase810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesCast810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesDrive810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesFitness810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesGames810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesGcm810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesIdentity810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesLocation810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesMaps810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesNearby810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesPanorama810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesPlus810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesSafetynet810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesVision810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesWallet810Library UP-TO-DATE 
    :app:prepareComGoogleAndroidGmsPlayServicesWearable810Library UP-TO-DATE 
    :app:prepareComGordonwongMaterialSheetFab103Library UP-TO-DATE 
    :app:prepareJpWasabeefRecyclerviewAnimators122Library UP-TO-DATE 
    :app:prepareNetSimonvtMenudrawerMenudrawer306Library UP-TO-DATE 
    :app:prepareOrgSufficientlysecureHtmlTextview12Library 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:preDebugAndroidTestBuild UP-TO-DATE 
    :app:prepareDebugAndroidTestDependencies 
    :app:compileDebugAndroidTestAidl UP-TO-DATE 
    :app:processDebugAndroidTestManifest UP-TO-DATE 
    :app:compileDebugAndroidTestRenderscript UP-TO-DATE 
    :app:generateDebugAndroidTestBuildConfig UP-TO-DATE 
    :app:generateDebugAndroidTestAssets UP-TO-DATE 
    :app:mergeDebugAndroidTestAssets UP-TO-DATE 
    :app:generateDebugAndroidTestResValues UP-TO-DATE 
    :app:generateDebugAndroidTestResources UP-TO-DATE 
    :app:mergeDebugAndroidTestResources UP-TO-DATE 
    :app:processDebugAndroidTestResources UP-TO-DATE 
    :app:generateDebugAndroidTestSources UP-TO-DATE 
    :app:compileDebugNdk UP-TO-DATE 
    :app:compileDebugJava UP-TO-DATE 
    :app:preDexDebug UP-TO-DATE 
    :app:dexDebug 
    UNEXPECTED TOP-LEVEL EXCEPTION: 
    com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 
     at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502) 
     at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277) 
     at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) 
     at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168) 
     at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) 
     at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) 
     at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) 
     at com.android.dx.command.dexer.Main.run(Main.java:246) 
     at com.android.dx.command.dexer.Main.main(Main.java:215) 
     at com.android.dx.command.Main.main(Main.java:106) 
    Error:Execution failed for task ':app:dexDebug'. 
    > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2 

我想這應該要涉及到圖書館的版本,也許是因爲他們是不是最新版本。關於如何處理這個錯誤的任何線索?

回答

2

您收到此錯誤,因爲你已經超過了65K方法限制:

Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, including Android framework methods, library methods, and methods in your own code. Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.

您可以找到有關65K方法和方法的詳細信息,以避免此問題: https://developer.android.com/tools/building/multidex.html

+0

謝謝。這解決了我的問題。 – FilipLuch

相關問題