The same input jar is specified twice 解决办法

在Android Studio项目中遇到警告提示'The same input jar […….jar] is specified twice'时,可通过修改proguard.cfg文件中的配置来解决此问题。原因在于build.gradle文件和混淆配置文件中都包含了相同的jar包引用。正确的做法是在所有-libraryjars前插入#进行注释或删除重复的引用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The same input jar is specified twice 解决办法

Android studio打包中遇到了这样的问题

Warning:Exception while processing task java.io.IOException: The same input jar […….jar] is specified twice.

解决方法如下:

打开 proguard.cfg
在所有的-libraryjars 前插入 # 成 #-libraryjars xxxx.jar

原因分析

原因是build.gradle文件配置了

dependencies {
    compile fileTree(include: '*.jar', dir: 'libs')
}

里面已经添加过jar包,混淆文件proguard.cfg里面又加了句-libraryjars libs/***.jar,将-libraryjars libs/***.jar 前面用#号注释或者直接删掉即可。

sdk 通过 proguard 混淆代码时默认已经将 lib目录中的 jar 都已经添加到打包脚本中,所以不需要再次手动添加。

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值