每当我尝试调试和部署我的android应用程序(在Android Studio 0.9中)时,都会出现以下错误:
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: android/support/multidex/BuildConfig.class
在这里澄清一下是我的行动的简要历史记录:
- 今天早上项目运行良好
- 添加了一些其他的类和方法
- 打破限制并收到以下错误:
Unable to execute dex: method ID not in [0, 0xffff]: 65536
- 由于无法减少依赖关系,因此决定向我的项目添加multiDex支持
最新回答
- 2021-1-121 #
- 2021-1-122 #
线程有点旧,但是我也遇到了这个错误。
我的问题是我使用了两种不同的 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-123 #
要诊断并解决此问题,请运行以下gradle命令:
./gradlew clean app:dependencies
这将在树中列出应用程序中的所有依赖项.在结果中搜索令人讨厌的重复类,然后添加
compile('naughty.library') { exclude group: 'foo', module: 'bar' }
删除重复项。
- 2021-1-124 #
我最近遇到了此错误,在查看我在Android Studio中的"外部库"后,发现我的库之一包含在两个版本号下. (在这种情况下,这是在线运行时间1.5.1和1.5.2)。
我建议在项目视图中查看"外部库",然后查看那里是否有任何冗余库.它还包括传递依赖项,因此您可能会在其中找到令您感到惊讶的东西。
- 2021-1-125 #
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' }
相关问题
- gradle:找不到名称为"默认"的配置 Android Studioandroidgradleandroidstudioandroidgradle2021-01-11 22:27
- android:所有屏幕设备的图像尺寸androidimageandroidlayoutandroidstudioimagesize2021-01-12 01:25
- libpng错误:Android Studio中显示的不是PNG文件错误androidandroidstudiobuild.gradle2021-01-12 00:24
- java:Android Studio TransformException:错误:任务':app:transformClasseswithDexForDebug'的执行失败javaandroidandroidstudio2021-01-11 05:58
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
哎呀。我不认为我们做错了什么.我认为这是领先的征兆.我提出了一个错误报告。