我創建了一個簡單的Hello World項目,但我收到以下錯誤:錯誤:任務':app:transformClassesWithDexForDebug'的執行失敗。 >
Error: Execution failed for task '`:app:transformClassesWithDexForDebug`'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1.
我在的build.gradle添加multiDexEnabled true
但它仍然表示對上述錯誤。
我的build.gradle文件: -
android {
compileSdkVersion 23
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.bliss76.myapplication"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
的【JAVA與非零退出值2結束 - Android的搖籃]可能重複連接(https://stackoverflow.com/questions/29756188/java-finished-with -non-zero-exit-value-2-android-gradle) –
粘貼你的gradle文件和multidex代碼 –
試試這種方法來啓用multidex 請按照這個[link](https://stackoverflow.com/questions/44603154/how -to-fix-android-4-4-2-錯誤-classnotfoundexception-didnt-find-class-com-go/44603205)#443603205 –