安卓打包时出现The same input jar * is specified twice问题(代码混淆相关):
问题描述
Android Studio项目打包时出现以下错误提示:
Warning:Exception while processing task java.io.IOException: The same input jar [D:\biaoqiProject2\ss28\app\libs\alipaySdk-20160516.jar] is specified twice.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
解决方法:
解决方法就是在proguard-rules.pro文件中,把-libraryjars libs/alipaySDK-20160516.jar注释掉或者删掉。(在eclipse中需要,用在android studio中时不需要)
这句话的通用格式是–librarys libs/xxx。
问题分析:
通过 Android Studio进行 混淆代码时,默认已经将 lib目录中的 jar 都已经添加到打包脚本中,所以不需要再次手动添加,否则会出现“ java.io.IOException: The same input jar is specified twice”错误。
第一次写博客,就当记录一下开发中遇到的问题。