簡體   English   中英

app:dexDebug在build.gradle Android Studio中出錯

[英]app:dexDebug error in build.gradle Android Studio

嘗試在Android Studio上運行項目時,我收到app:dexDebug錯誤。 我相信這與我的依賴關系有關,但我不確定我要去哪里。

錯誤是:

錯誤:任務':app:dexDebug'的執行失敗。

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:進程'命令'C:\\ Program Files \\ Java \\ jdk1.7.0_17 \\ bin \\ java.exe'以非零退出值2

我對build.gradle文件的依賴關系如下:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2'
}

任何人都可以在這里指出正確的方向。

謝謝。

更新

通過將以下內容添加到我的build.gradle中來解決問題

packagingOptions {
        exclude 'META-INF/license.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/NOTICE'
    }

Android Studio中Error:Execution failed for task ':app:dexDebug'來解決它設置multiDexEnabledtrue在你的文件的gradle。

defaultConfig {        
    // Enabling multidex support.
    multiDexEnabled true
}

該問題很可能是由於添加了所有播放服務依賴項引起的。 您不應該將整個API包編譯到您的應用中,否則會增加應用中方法的數量。 app:dexDebug錯誤指示您已超過65k方法限制。 在build.gradle中刪除此行: compile 'com.google.android.gms:play-services:8.3.0'然后從這些單獨的依賴項中進行選擇,這些依賴項將根據您的應用程序的需要進行添加。 例如,要使用Gcm,您只需添加compile 'com.google.android.gms:play-services-gcm:8.4.0'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM