Android程序进行混淆,在导出签名apk包时出错!

http://blog.csdn.net/diruser/article/details/7969120


今天终于完成了近一个月的App开发工作,对程序进行混淆导出签名apk包时,却出现了如下的错误:
Proguard returned with error code 1. See console
Note: there were 4 duplicate class definitions.
Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
Warning: library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
。。。

心里想着,真是好事多磨呀!
那就赶紧问度娘呀,终于在一位网友那里找到了答案。
对于Android导入了第三方jar包时,proguard混淆脚本会出现错误,而出现上面的错误是因为程序中引入了第三方jar包[ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar],二话不说,立马行动:

在proguard-project.txt中增加了
-ignorewarnings
-libraryjars lib/ksoap2-android-assembly-2.5.4-jar-with-dependencies.jar (jar包路径)

即在文件中增加了如下红色的两行:

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-ignorewarnings

# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
#-dontoptimize
# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.
-libraryjars libs/ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar 


-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService


最后,重新打包,一切OK。

这里写图片描述 

欢迎您扫一扫上面的微信公众号,订阅我的个人公众号!本公众号将以推送Android各种碎片化小知识或小技巧,以及整理Android网络,架构,面试等方面的知识点为主,也会不定期将开发老司机日常工作中踩过的坑,平时自学的一些知识总结出来进行分享。每天一点干货小知识把你的碎片时间充分利用起来。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值