zoukankan      html  css  js  c++  java
  • android——混淆打包

    网上搜了一大堆,在此不一一赘诉。

    直接讲解了

    如上图这么配置,其实就是加上一句话而已。告诉打包工具混淆打包的代码放在./proguard-project.txt这里

    proguard.config=./proguard-project.txt
    

     进入proguard-project.txt文件 

    有人说放开上面的注释就可以了。可惜。我没弄懂,低版本好像可以。

    # :后面跟的是注释,可以不用看。

    
    
    -dontwarn android.app.**
    -keep class android.app.**{*;}
    
    
    

    上面两句话,我用导很多,因为我引用了很多的第三方包。第三方包我们可以不用去混淆。所以,dontwarn 是告诉打包工具,这个包别警告了。 keep是保持包里面的类和方法。

    剩下的。就可以从我这里直接拷贝了。

    # 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 *;
    #}
    -dontpreverify
    
    -repackageclasses ''
    
    -allowaccessmodification
    
    -optimizations !code/simplification/arithmetic
    
    -keepattributes *Annotation*
    
    #-dontwarn com.xx.bbb.**
    #-keep class com.xx.bbb.** { *;}
    
    -dontwarn android.app.**
    -keep class android.app.**{*;}
    
    -dontwarn android.support.**
    -keep class android.support.**{*;}
    
    -dontwarn com.tencent.**
    -keep class com.tencent.**{*;}
    
    -dontwarn org.apache.http.entity.mime.**
    -keep class org.apache.http.entity.mime.**{*;}
    
    -dontwarn com.newland.**
    -keep class com.newland.**{*;}
    
    -dontwarn com.umeng.**
    -keep class com.umeng.**{*;}
    
    -dontwarn com.baidu.location.**
    -keep class com.baidu.location.**{*;}
    
    
    -dontwarn com.squareup.picasso.**
    -keep class com.squareup.picasso.**{*;}
    
    -dontwarn Decoder.**
    -keep class Decoder.**{*;}
    
    -dontwarn com.quickpos.**
    -keep class com.quickpos.**{*;}
    
    -dontwarn com.sina.**
    -keep class com.sina.**{*;}
    
    -dontwarn com.itron.**
    -keep class com.itron.**{*;}
    
    -dontwarn com.qtpay.qtjni.**
    -keep class com.qtpay.qtjni.**{*;}
    
    -dontwarn com.hx.messagejar.**
    -keep class com.hx.messagejar.**{*;}
    
    -dontwarn com.loopj.android.http.**
    -keep class com.loopj.android.http.**{*;}
    
    -dontwarn com.nostra13.universalimageloader.**
    -keep class com.nostra13.universalimageloader.**{*;}
    
    -dontwarn com.readystatesoftware.systembartint.**
    -keep class com.readystatesoftware.systembartint.**{*;}
    
    -dontwarn com.pgyersdk.**
    -keep class com.pgyersdk.**{*;}
    
    -dontwarn Decoder.**
    -keep class Decoder.**{*;}
    
    -dontwarn Decoder.**
    -keep class Decoder.**{*;}
    
    
    -keep public class * extends android.app.Activity
    
    -keep public class * extends android.app.Application
    
    -keep public class * extends android.app.Service
    
    -keep public class * extends android.content.BroadcastReceiver
    
    -keep public class * extends android.content.ContentProvider
    
    -keep public class * extends android.view.View {
    
        public <init>(android.content.Context);
    
        public <init>(android.content.Context, android.util.AttributeSet);
    
        public <init>(android.content.Context, android.util.AttributeSet, int);
    
        public void set*(...);
    
    }
    
    -keepclasseswithmembers class * {
    
        public <init>(android.content.Context, android.util.AttributeSet);
    
    }
    
    -keepclasseswithmembers class * {
    
        public <init>(android.content.Context, android.util.AttributeSet, int);
    
    }
    
    -keepclassmembers class * implements android.os.Parcelable {
    
        static android.os.Parcelable$Creator CREATOR;
    
    }
    
    -keepclassmembers class **.R$* {
    
        public static <fields>;
    
    }
  • 相关阅读:
    leetcode计划(二)——ps:复习面试题计划+锻炼计划
    随感——简述码农办公提升工作效率的方法
    git——同步本地文件到github上
    算法数据结构——数的深搜和广搜(dfs和bfs)
    二分查找——没有想象中的容易(详解各种变式,超深度理解,c++)
    微软推出免费的Linux取证和Rootkit恶意软件检测服务
    美国采用人工智能领域来对抗种族偏见
    美联邦专家警告:黑客瞄准在家工作的美国人
    90后从白手起家到身价过亿,却坐地铁上班
    互联网巨头的人工智能野心,你看懂了吗?
  • 原文地址:https://www.cnblogs.com/shoneworn/p/5311868.html
Copyright © 2011-2022 走看看