私のプロジェクトは、Parse を使用するチャット アプリです。他の依存関係を追加した後、この問題が発生し始めました:
エラー: タスク ':app:dexDebug' の実行に失敗しました。com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: プロセス 'command '/usr/lib/jvm/java-7-oracle/bin/java'' がゼロ以外の終了で終了しました値 2
ここで StackOverflow を検索すると、Android の 65K の制限である可能性があると言う人もいました。したがって、解決するために、次の手順に従いました。
1 - マルチデックスを追加
DefaultConfig {
multiDexEnabled true
}
と
compile 'com.android.support:multidex:1.0.0'
https://developer.android.com/tools/building/multidex.html
2 - Android Gradle 設定でジャンボ モードを有効にする
dexOptions {
jumboMode = true
}
プロジェクトをクリーンアップし、gradle ビルドを実行しました。エラーは発生しませんでした。すごい!しかし、「アプリを実行」をクリックすると、以下のエラーが発生します。
エラー: タスク ': app: packageAllDebugClassesForMultiDex' の実行に失敗しました。> Java.util.zip.ZipException: エントリが重複しています: ボルト / AggregateException.class
依存関係「com.parse.bolts:bolts-android:1.+」を削除すると、「アプリの実行」は機能しますが、Parse の依存関係なしでは実行できません。
これは私のGradleビルドスクリプトです:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "br.com.triangulum.mink"
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode = true
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile('com.android.support:multidex:1.0.0') {
exclude group: 'com.parse.bolts',
module: 'bolts-android'
}
androidTestCompile 'com.android.support:multidex-instrumentation:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: 'Parse*.jar')
compile project('libraries:httprequest')
compile project('libraries:cameralibrary')
compile project('libraries:bgarefreshlayout')
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:design:+'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.afollestad:material-dialogs:0.7.4.0'
compile 'com.getbase:floatingactionbutton:1.10.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'de.greenrobot:eventbus:2.4.+'
compile'com.edmodo:cropper:1.0.+'
compile 'com.github.ksoichiro:android-observablescrollview:+'
compile 'com.etsy.android.grid:library:1.0.5'
compile('com.mikepenz:actionitembadge:3.0.2@aar') {
transitive = true
}
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.android.support:multidex:1.0.+'
}