android - 使用 Parse 和 Multidex 复制条目

标签 android parse-platform gradle android-multidex

我的项目是一个使用 Parse 的聊天应用程序。添加其他依赖后,开始出现这个问题:

Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-oracle/bin/java'' finished with non-zero exit value 2

在 StackOverflow 中搜索这里,一些人告诉我这可能是 Android 的 65K 限制。 因此,为了解决,我按照以下步骤操作:

1 - 添加 Multidex

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 构建。它没有产生任何错误。伟大的!但是当我点击“运行应用程序”时,它会在下面生成此错误。

Error: Execution failed for task ': app: packageAllDebugClassesForMultiDex'. > Java.util.zip.ZipException: duplicate entry: bolts / 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.+'
}

最佳答案

试着改变这个:

compile('com.android.support:multidex:1.0.0') {
        exclude group: 'com.parse.bolts',
                module: 'bolts-android'
    }

对此:

compile('com.android.support:multidex:1.0.0');

bolds 模块有时用于修复重复的 dexLibs

问候

关于android - 使用 Parse 和 Multidex 复制条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32140704/

相关文章:

java - 如何获取和服务 Vertx SockJS eventbus javascript 客户端依赖项

android - 在另一个 recyclerView 中添加 recyclerView

android - 如何在 Windows 上为 Android 构建 gstreamer?

arrays - 在 swift 中调用解析函数失败

java - i/o 失败 : java.net.UnKnownHostException

ios - 如果输入的文本与解析字符串匹配,则在 Button Click 上打开一个新的 ViewController

android - 如何在 android 中使用 groovy 制作 integrationTest 源集?

android - android类的安全性

android - 为什么有些 ContextCompat.getExternalFilesDirs 不可访问?

java - Gradle 任务 assembleDebug 失败,退出代码为 1(运行时异常)