如何解决打包的时候出现Execution failed for task ':app:transformClassesWithJarMergingForDebug'等问题
2017-03-24 17:45
513 查看
如何解决打包的时候出现Execution failed for task ‘:app:transformClassesWithJarMergingForDebug’等问题
今天项目上线 打包的时候遇到一个问题:
正常的debug调试的时候 每次编译都不通过 会提示:
app:transformClassesWithJarMergingForDebug:java.util.zip.ZipException: duplicate entry: android/support/-v7/app/RecyclerView$RecycleViewPool.class
网上度娘找了许多方法,都说是有架包和-v7的Recycle冲突,问题找到了,但是网上给出的解决方法都尝试过了,包括在bulid.gradle中的 buildTypes 的 release 中添加 zipAlignEnabled true ,替换架包等,但是一直没有解决
最后终于找到了解决的方法 废话不说 直接上解决办法
- 首先分别找到使用RecyclerView和RecycleViewPool的使用位置
- 将两个class所导入的RecyclView包进行对比
- 查找重复的地方
最终发现了问题所在,是项目之前到如果一个RecycleView 的架包,但是后来弃用了,只是在gradle中去掉了,并没有将原始的架包删除,最终导致了这个问题,于是删除架包,重新打包,打包成功
另外贴出来其他几种打包遇到问题的解决方法1.dexDebug ExecException finished with non-zero exit value 2
需要在gradle中配置下面的代码,原因是引用了多个libraries文件
defaultConfig {
multiDexEnabled true
}
2.Execution failed for task ‘:app:transformClassesWithJarMergingForDebug’.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/app/BackStackState$1.class
原因:在所添加的jar包或aar包中也引用了support-V4,与工程中引用的相冲突
Ctrl+N –> 在搜索框中输入BackStackState –> 查找到所有引用该类的类,这些类即为引起冲突的类
去掉本工程中gradle中用于引用有冲突的包的代码或者将冲突的代码从jar包或aar包中移除,确保一个module中只引用了一份相同的第三方包
3.project sturcture和Project Structure 无论是按快捷键或者是从files中打开都不显示
event log中报:IllegalArgumentException:Multiple entries with same key: Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23) and Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23)
解决办法:先看一下系统配置的SDK的位置和Android Studio所用的路径是否一致,如果不一致重新配置系统的SDK路径或者是重新修改Android Studio的SDK路径
通过SDK Manager删除掉google API23
如果解决不了,卸载android studio –>重新安装 ,还有问题点击File –> Invalidate Cashes/Restart –> Invalidate and Restart,解决不了继续通过SDK Manager删除掉google API23
相关文章推荐
- 【Android】AndroidStudio打包apk出现的一些问题 `Error:Execution failed for task ':app:lintVitalRelease'.
- AndroidStudio打包apk出现的一些问题 `Error:Execution failed for task ':app:lintVitalRelease'.
- [置顶] 【Android】AndroidStudio打包apk出现的一些问题 `Error:Execution failed for task ':app:lintVitalRelease'.
- AS中运行项目时出现Error:Execution failed for task ':app:transformClassesWithDexForDebug'...问题解决
- Not a PNG file...Error Execution failed for task app mergeDebugResource...问题解决
- 关于android studio 出现Error:Execution failed for task ':app:buildInfoDebugLoader'.的解决办法
- AndroidStudo编译时出现“Error:Execution failed for task ‘:app:mergeDebugResources‘. > Some file cru'”,解决办法
- 完美解决Error:Execution failed for task ':APP:transformClassesWithDexForDebug'...问题
- 关于android studio 出现Error:Execution failed for task ':app:buildInfoDebugLoader'.的解决办法
- Error:Execution failed for task ':app:mergeDebugResources'问题解决
- android studio 打包发布签名后的apk文件时出现Error:Execution failed for task ':app:transformClassesAndResourcesWi
- Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed with 问题解决方案
- android studio DEX 方法超过64K限制和gradle编译OOM问题解决,异常名:Error:Execution failed for task ':app:dexDebug'. >
- Android Studio运行或Rebuild的时候报Error:Execution failed for task ':app:compileDebugNdk'.的解决办法
- 解决Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'问题
- 用AndroidStudio打包APK时出现Error:Execution failed for task ':app:validateSigningRelease'. > Keystore file
- Error: Execution failed for task ':app:clean'. Unable to delete file问题解决
- eclipse 工程导入到Android Studio 出现的问题Error:Execution failed for task ':app:mergeDebugResources'. >
- 解决AS混淆时出现的错误Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'
- android studio 出现Error:Execution failed for task ':app:buildInfoDebugLoader'.的解决办法