[明文流程] Android混淆

网上好多混淆教程,但是看别人的总不如看自己的,而且比较喜欢傻瓜式教程...所以还是自己倒腾好了


先是混淆前后的Demo效果图对比


源码:


①混淆前


②混淆后



** Test之所以没被混淆是我特意做了测试 : 指定某个类不被混淆

    MainActivity之所以没被混淆是因为Android本身就规定了Activity,Service是没法被混淆的(如果这都混淆了那程序自己运行起来也麻烦死了,生命周期都乱成一团)

至于是不是四大组件全都不能被混淆就不清楚了,测试一下即可得知


1:工程下有两个文件

project.properties是开启混淆的

proguard-project.txt 是主要是你的混淆需求都会写在这里


2:开启混淆

在project.proerties中


正常情况下

该文件只会有第一句  target=android-18

如果需要混淆则需加上后面那句

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

这样在打包的时候会自动进行混淆


3:proguard-project.txt

该文件的内容有一部分是Google自带的

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}


这一部分的效果是  :  对你的工程进行混淆 (前提是 你的工程完全没用到第三方包  如果有第三方包 需要在此基础上进行增加)


4:语法  (效果是  例如对某个特定类指定不混淆)

-keep class com.example.httpdemo.Test {*;}  

其中   class com.example.httpdemo.Test 是你的类的绝对路径



--------------------------------------------------

目前只测试了这些  都写上来了 以后有新用的再增

--------------------------------------------------

参考链接

http://blog.csdn.net/lovexjyong/article/details/24652085

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值