首页>Program>source

每当我尝试调试和部署我的android应用程序(在Android Studio 0.9中)时,都会出现以下错误:

Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: android/support/multidex/BuildConfig.class

在这里澄清一下是我的行动的简要历史记录:

  1. 今天早上项目运行良好
  2. 添加了一些其他的类和方法
  3. 打破限制并收到以下错误: Unable to execute dex: method ID not in [0, 0xffff]: 65536
  4. 由于无法减少依赖关系,因此决定向我的项目添加multiDex支持

此后,通过按照以下SO帖子

我还有另一个项目依赖项来使用 viewPagerIndicator 库以及我的/ libs文件夹中的几个jar:

  • android-async-http-1.4.6.jar
  • guice-3.0-no_aop.jar
  • jsr305-1.3.9.jar
  • roboguice-2.0.jar

欢迎提出有关如何解决此问题而不删除任何所需依赖项的任何建议!

最新回答
  • 2021-1-12
    1 #

    Edit: This is a bug and a fix is due. See https://code.google.com/p/android/issues/detail?id=81804

    我也有这个问题,我没有答案.但是,我可以添加以下内容:

    BuildConfig 是在构建过程中生成的魔术类.由于某种原因,存在一个具有相同全限定名称的版本( android.support.multidex.BuildConfig )在两个 mutildex-1.0.0中 和 multidex-instrumentation-1.0.0 哎呀。

    我不认为我们做错了什么.我认为这是领先的征兆.我提出了一个错误报告。

  • 2021-1-12
    2 #

    线程有点旧,但是我也遇到了这个错误。

    我的问题是我使用了两种不同的 gradle文件中的com.google.android.gms:play-services版本。

    compile 'com.google.android.gms:play-services-gcm:7.5.0'
    compile 'com.google.android.gms:play-services-analytics:7.3.0' // WRONG!
    

    请确保您始终使用相同的版本,例如:

    compile 'com.google.android.gms:play-services-gcm:7.5.0'
    compile 'com.google.android.gms:play-services-analytics:7.5.0'
    

  • 2021-1-12
    3 #

    要诊断并解决此问题,请运行以下gradle命令:

    ./gradlew clean app:dependencies
    

    这将在树中列出应用程序中的所有依赖项.在结果中搜索令人讨厌的重复类,然后添加

    compile('naughty.library') {
        exclude group: 'foo', module: 'bar'
    }
    

    删除重复项。

  • 2021-1-12
    4 #

    我最近遇到了此错误,在查看我在Android Studio中的"外部库"后,发现我的库之一包含在两个版本号下. (在这种情况下,这是在线运行时间1.5.1和1.5.2)。

    我建议在项目视图中查看"外部库",然后查看那里是否有任何冗余库.它还包括传递依赖项,因此您可能会在其中找到令您感到惊讶的东西。

  • 2021-1-12
    5 #

    1.update google play服务

    2.add

    compile 'com.google.android.gms:play-services-fitness:8.1.0'
    compile 'com.google.android.gms:play-services-wearable:8.1.0'
    

    代替 compile 'com.google.android.gms:play-services:8.1.0'

    在build.gradle文件中。

    3。

    defaultConfig {
        multiDexEnabled true
    }
    dependencies {
        compile 'com.android.support:multidex:1.0.1'
    }
    

  • javascript:正则表达式提取子字符串,由于某种原因返回2个结果
  • .net:实体框架是否支持并行异步查询?