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>;
    
    }
  • 相关阅读:
    The POM for XXX is invalid, transitive dependencies (if any) will not be available解决方案
    Builgen 插件——IntelliJ IDEA和Eclipse Java Bean Builder模式代码生成器-比lombok更符合需求
    java.lang.NoClassDefFoundError: org/apache/curator/RetryPolicy解决方法
    java配置xml报cvc-complex-type.2.3: 元素 'beans' 必须不含字符 [子级], 因为该类型的内容类型为“仅元素”
    Spring Boot中注入配置文件application.properties中的list 对象参数
    Spring Boot 整合Mybatis非starter时,mapper一直无法注入解决
    org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout() mybatis和spring-mybatis版本不匹配问题
    mybatis generator自动生成sqlmap代码的不完善之处以及解决方法
    pagehelper调用mybatis报错java.lang.NoSuchMethodError:org.apache.ibatis.reflection.MetaObject.forObject
    iframe跨域问题:Uncaught DOMException: Blocked a frame with origin解决方法
  • 原文地址:https://www.cnblogs.com/shoneworn/p/5311868.html
Copyright © 2011-2022 走看看