使用Parse和Multidex重复输入 [英] Duplicate entry using Parse and Multidex

查看:237
本文介绍了使用Parse和Multidex重复输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


错误:执行任务':app:dexDebug'失败。
com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'/ usr / lib / jvm / java-7-oracle / bin / java''已完成非零退出值2


在StackOverflow中搜索这里,一些人告诉我,它可能是Android的65K限制。
所以,解决我遵循以下步骤:

1 - 添加Multidex

  DefaultConfig {
multiDexEnabled true
}



  compile'c​​om.android.support:multidex:1.0.0'

https:// developer.android.com/tools/building/multidex.html



2 - 在Android Gradle设置中启用巨型模式

  dexOptions {
jumboMode = true
}

我清理了项目并运行了gradle build。它没有产生任何错误。大!但是当我点击运行应用程序时,它会在下面产生这个错误。
$ b blockquote>

错误:执行失败,执行任务':app:
packageAllDebugClassesForMultiDex。 > Java.util.zip.ZipException:
重复项目:bolts / AggregateException.class


如果我删除依赖项' com.parse.bolts:bolts-android:1. +'该运行应用程序的作品,但我不能没有解析的依赖。



这是我的Gradle构建脚本:

  apply plugin:'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion22.0.1

defaultConfig {
applicationIdbr.com.triangulum.mink
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName1.0
multiDexEnabled true

}
buildTypes {
release {

minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
dexOptions {
jumboMode = tru e


存储库{
mavenCentral()
}

依赖关系{
compile'c​​om.parse.bolts :bolts-android:1. +'
compile('com.android.support:multidex:1.0.0'){
exclude group:'com.parse.bolts',
module :'bolts-android'
}
androidTestCompile'c​​om.android.support:multidex-instrumentation:1.0.0'
编译fileTree(dir:'libs',include:['*。 jar'])
编译fileTree(dir:'libs',包括:'Parse * .jar')
编译项目('libraries:httprequest')
编译项目('libraries:cameralibrary ')
compile project('libraries:bgarefreshlayout')
compile'c​​om.android.support:appcompat-v7:+'
compile'c​​om.android.support:recyclerview-v7:+ '
compile'c​​om.android.support:cardview-v7:+'
compile'c​​om.android.support:palette-v7:+'
compile'c​​om.android.support:design :+
compile'c​​om.daimajia.swipelayout:library:1.2.0@aar'
compile'c​​om.google.android.gms:play-services:6.5.87'
compile'c​​om。 google.code.gson:gson:2.2。+'
compile'c​​om.squareup.picasso:picasso:2.4.0'
compile'c​​om.jakewharton:butterknife:7.0.1'
compile'c​​om.afollestad:material-dialogs:0.7.4.0'
compile'c​​om.getbase:floatingactionbutton:1.10.0'
compile'c​​om.facebook.android:facebook-android-sdk:4.1。 0'
compile'de.greenrobot:eventbus:2.4。+'
compile'c​​om.edmodo:cropper:1.0。''
compile'c​​om.github.ksoichiro:android-observablescrollview: +'
compile'c​​om.etsy.android.grid:library:1.0.5'
compile('com.mikepenz:actionitembadge:3.0.2@aar'){
transitive = true
}
compile'c​​om.daimajia.swipelayout:library:1.2.0@aar'
compile'c​​om.android.support:multidex:1.0.+'
}




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

至此:

 编译( 'com.android.support:multidex:1.0.0'); 

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

问候


My project is a Chat app that uses Parse. After added other dependencies, this problem started appearing:

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

Searching here in StackOverflow, some folks told me that it could be the 65K limit from Android. So, to solve I followed the steps below:

1 - Add Multidex

DefaultConfig {
         multiDexEnabled true
}

and

compile 'com.android.support:multidex:1.0.0'

https://developer.android.com/tools/building/multidex.html

2 - Enable Jumbo Mode in Android Gradle Settings

 dexOptions {
        jumboMode = true
 }

I cleaned the project and ran the gradle build. It did not generate any errors. Great! But when I click "Run app" it generates this error below.

Error: Execution failed for task ': app: packageAllDebugClassesForMultiDex'. > Java.util.zip.ZipException: duplicate entry: bolts / AggregateException.class

If I remove the dependency 'com.parse.bolts: bolts-android: 1. +' the "Run app" works, but I can not do without the dependency of Parse.

This is my Gradle build script:

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.+'
}

解决方案

try to change this:

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

To this:

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

the bolds module is used sometimes to fix Duplicated dexLibs

Regards

这篇关于使用Parse和Multidex重复输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆