2015-11-17 25 views
0

我的build.gradle喬達時間或喬達 - 時間的android錯誤:執行失敗的任務「:應用程序:dexDebug」

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.1" 

defaultConfig { 
    applicationId "com.xcompany.xapplication" 
    minSdkVersion 15 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
} 

buildTypes { 
    release { 
    minifyEnabled false 
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 

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

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
    compile 'joda-time:joda-time:2.9.1' 
} 

當我試圖讓APK並運行應用程序出錯:

Error:Execution failed for task ':app:dexDebug'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2 

它看起來像proguard配置問題,但proguard-rules.pro中的joda類的設置不起作用。

我Proguard的配置:

-dontwarn org.joda.convert.** 
-dontwarn org.joda.time.** 
-keep class org.joda.time.** { *; } 
-keep interface org.joda.time.** { *; } 

回答

0

我加入解決了這個問題multiDexEnabled真正到的build.gradle

defaultConfig { 
    applicationId "com.xcompany.xapplication" 
    multiDexEnabled true  
    minSdkVersion 15 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
} 

我找到了解決方案here的defaultConfig部分。