android 混淆相关 proguard

1、再android上使用混淆比较简单,只需要在project.propreties文件中添加一行

proguard.config=proguard.cfg

如果不存再proguard.cfg文件,可以自己创建

2、如果引入了第三方包,又不需要混淆则:

指定第三方的包 -libraryjars

-libraryjars libs/android-support-v4.jar

忽略jar包中的警告:

-dontwarn android.support.v4.**

忽略警告:

-ignorewarnings

指定不混淆的包:

-keep class android-support-v4.**{*;}

指定继承包的类不混淆:

-keep public class * extends android.support.v4.**

另外如果是android.support.v4包可能需要用最新的sdk。

指令介绍
http://proguard.sourceforge.net/index.html#manual/usage.html

原理介绍:
http://proguard.sourceforge.net/index.html#manual/introduction.html

例子介绍:

http://proguard.sourceforge.net/index.html#manual/examples.html

各种异常已经解答列表
http://proguard.sourceforge.net/index.html#manual/troubleshooting.html

原文地址:https://www.cnblogs.com/lipeil/p/2653890.html