2017-06-20 68 views
0

我創建了一個簡單的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' 
} 
+0

的【JAVA與非零退出值2結束 - Android的搖籃]可能重複連接(https://stackoverflow.com/questions/29756188/java-finished-with -non-zero-exit-value-2-android-gradle) –

+0

粘貼你的gradle文件和multidex代碼 –

+0

試試這種方法來啓用multidex 請按照這個[link](https://stackoverflow.com/questions/44603154/how -to-fix-android-4-4-2-錯誤-classnotfoundexception-didnt-find-class-com-go/44603205)#443603205 –

回答

0

你有沒有想起改變清單?

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.example.myapp"> 
<application 
     android:name="android.support.multidex.MultiDexApplication" > 
    ... 
</application> 

瞭解更多關於它here

0

嘗試與依賴

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

它已經附上 –

相關問題