我正在使用Android工作室爲學校的Android應用程序,我試圖使用Jersey客戶端連接應用程序與我的Web服務。當我嘗試添加Jersey客戶端所需的jar並編譯該項目時,出現以下錯誤。錯誤:執行任務':app:dexDebug'失敗。
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_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
從爲解決這一問題摸索在我看來,它正在發生,因爲我加入的罐子超過上方法65K的限制。我也看到,這可以通過使用我試圖實現的multidex支持來解決,但是當我編譯gradle時,錯誤依然存在。
這裏是我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.williamj.hertz"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/LISCENSE.txt'
exclude 'META-INF/LISCENSE'
exclude 'META-INF/liscense.txt'
}
dexOptions{
incremental true
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.parse:parse-android:1.10.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:multidex:1.0.1'
}
而且這裏是我加入multidex支持
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:name="android.support.multidex.MultiDexApplication">
我假設,我只是沒有實現multidex我AndroidManifest的一部分正確支持。任何幫助解決這個錯誤將不勝感激,謝謝。