相关疑难解决方法(0)

无法执行dex:多个dex文件定义Lbolts/AggregateException

我知道之前已经多次报告过多个dex问题,但是在我的情况下似乎没有一个解决方案可行.

安慰:

    Unable to execute dex: Multiple dex files define Lbolts/AggregateException;
    Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lbolts/AggregateException;
Run Code Online (Sandbox Code Playgroud)

其中一个流行的解决方案是从buildpath中取消标记"Android私有库"容器.我不能这样做,因为我需要的容器中还有一些库.

另一个解决方案是取消标记以.jar形式显式添加的任何重复库.我没有这样的图书馆.

我的重复库是:android-support-v7-appcompat.jar 我在这两个容器中有它(直接从sdk文件夹引用):

1.)Android私人图书馆

2.)Android依赖项

问题是我不能完全解开这两个容器中的任何一个,因为它们都包含其他必要的库.但我也无法从任何容器中删除这个重复的.jar文件.

编辑: NB当我将android-support-v7-appcompat library_project添加到我的项目时,它进入两个容器.必须有某种方式,只进入一个.

任何人都可以帮助我如何做到这一点?

截图

screenshot2(无法删除)

java android android-appcompat android-support-library bolts-framework

18
推荐指数
2
解决办法
7778
查看次数

Android Studio Gradle错误"多个dex文件定义..."

我的项目工作正常,当我将facebook sdk添加到我的项目中时我有这样的错误,我已经尝试了很多方法来解决这个问题,但我没有.我该怎么办?

  Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: bolts/AggregateException.class
Run Code Online (Sandbox Code Playgroud)

我的App gradle在下面

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.2'

    defaultConfig {
        applicationId "com.example.myproject"
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
        multiDexEnabled = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'

    compile project(':facebook')
}
Run Code Online (Sandbox Code Playgroud)

这是facebook build.gradle

apply plugin: 'com.android.library'

repositories {
  mavenCentral()
}

project.group …
Run Code Online (Sandbox Code Playgroud)

android facebook-android-sdk android-studio android-gradle-plugin

11
推荐指数
3
解决办法
1万
查看次数