Android Studio 混淆打包 IOException: Please correct the above warnings first

当遇到IOException提示'Please correct the above warnings first.'时,不能忽视警告。根据官方建议,在proguard-rules.txt文件中添加'-dontwarn org.apache.http.**',然后可以成功执行Generate Signed APK并完成打包。
Android studio 混淆打包时,出现Error:Execution failed for task ':app:proguardRelease'.

> java.io.IOException: Please correct the above warnings first.


Warning:org.apache.http.impl.conn.tsccm.RouteSpecificPool: can't find referenced class org.apache.commons.logging.LogFactory
Warning:org.apache.http.impl.conn.tsccm.RouteSpecificPool: can't find referenced class org.apache.commons.logging.Log
Warning:org.apache.http.impl.conn.tsccm.RouteSpecificPool: can't find referenced class org.apache.commons.logging.LogFactory
Warning:org.apache.http.impl.conn.tsccm.RouteSpecificPool: can't find referenced class org.apache.commons.logging.Log
Warning:org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager: can't find referenced class org.apache.commons.logging.LogFactory
Warning:org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager: can't find referenced class org.apache.commons.logging.Log
Warning:org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager: can't find referenced class org.apache.commons.logging.LogFactory
Warning:org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager: can't find referenced class org.apache.commons.logging.Log
Warning:org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1: can't find referenced class org.apache.commons.logging.Log
Warning:there were 210 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 1 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
:app:proguardRelease FAILED
Error:Execution failed for task ':app:proguardRelease'.
> java.io.IOException: Please correct the above warnings first.

依照以往的管理,warn将其忽略就好了。但是现在不能忽略,影响打包的正常进行。

在官网找到这么一句话,Manual -> Troubleshooting -> “Warning: can’t find referenced class”,“try your luck with the -ignorewarnings option, or even the -dontwarn option”。

打开proguard-rules.txt,加入-dontwarn org.apache.http.**即可。

重新执行Generate Signed APK,打包成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值