Android ProGuard: Please correct the above warnings first的警

编译与反编译,一对相辅相成的矛盾。反编译有时候会和不光彩的事情联系在一起,以致于编译者常常费劲心思,加大反编译的难度,比如采用混淆代码等方式。ProGuard正是这么一个工具:

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure name.

Android SDK整合了ProGuard,并在文档中用了一个章节来描述如何使用它。依照文档来实施,多半没有问题,不过在我使用中遇到了一个问题:

[proguard] Warning: there were 2 unresolved references to classes or interfaces.
[proguard] You may need to specify additional library jars (using ‘-libraryjars’),
[proguard] or perhaps the ‘-dontskipnonpubliclibraryclasses’ option.
[proguard] Warning: there were 5 unresolved references to program class members.
[proguard] Your input classes appear to be inconsistent.
[proguard] You may need to recompile them and try again.
[proguard] Alternatively, you may have to specify the options
[proguard] ‘-dontskipnonpubliclibraryclasses’ and/or
[proguard] ‘-dontskipnonpubliclibraryclassmembers’.

BUILD FAILED
/Users/xuhj/Develop/android-sdk-mac_x86/tools/ant/main_rules.xml:453: Please correct the above warnings first.

依照以往的惯例,发生warning,可忽视之,只有看到error,才会小紧张一把。不过这次的warning导致了BUILD FAILED,这回问题大了。

按照提示,在proguard.cfg里,加入-dontskipnonpubliclibraryclasses,再试,还是有问题。

那就到官网找找答案吧,Manual -> Troubleshooting -> “Warning: can’t find referenced class”,找到这么一句话:try your luck with the -ignorewarnings option, or even the -dontwarn option.再对比日志信息,发现:

[proguard] Warning: net.poemcode.Digest: can’t find referenced class org.apache.CastleProvider

打开proguard.cfg,加入-dontwarn net.poemcode.**,再次执行ant release,万事大吉。

原文出至:http://blog.sina.com.cn/s/blog_3e28c8a50101fxak.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值