Android-混淆打包跟验证

1.混淆:找到项目project.properties添加

proguard.config=proguard-project.txt

2.在proguard-project.txt文件中,添加(具体根据需要百度,google 建议不要混淆系统派生类 ,一般也把第3方jar包声明成未被混淆)

-dontshrink
-dontpreverify 
-dontoptimize 
-dontusemixedcaseclassnames 


-flattenpackagehierarchy
-allowaccessmodification 
-printmapping map.txt 


-optimizationpasses 7 
-verbose 
-keepattributes Exceptions,InnerClasses
-dontskipnonpubliclibraryclasses 
-dontskipnonpubliclibraryclassmembers 
-ignorewarnings


-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 java.lang.Throwable {*;}
-keep public class * extends java.lang.Exception {*;}


-libraryjars libs/alipaysdk.jar
-libraryjars libs/alipaysecsdk.jar
-libraryjars libs/alipayutdid.jar


-libraryjars libs/jsoup-1.7.2.jar
-libraryjars libs/ZXing.jar
-libraryjars libs/fastjson-1.0.3.jar
-libraryjars libs/animations-2.4.0.jar
-libraryjars libs/android-support-v4.jar
-libraryjars libs/gson-2.2.4-javadoc.jar
-libraryjars libs/gson-2.2.4-sources.jar
-libraryjars libs/gson-2.2.4.jar


-keep class com.alipay.android.app.IAlixPay{*;}
-keep class com.alipay.android.app.IAlixPay$Stub{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
-keep class com.alipay.sdk.app.PayTask{ public *;}
-keep class com.alipay.sdk.app.AuthTask{ public *;}
-keep class com.alipay.mobilesecuritysdk.*
-keep class com.ut.*


-keepclasseswithmembernames class * {
    native <methods>;
}


-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}


-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}


-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}


-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}


-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}


# adding this in to preserve line numbers so that the stack traces
# can be remapped
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

3.打包生成正式环境apk

4.改成zip包后缀 取出文件classes.dex

5.利用dex2jar工具编译

dex2jar .../../classes.dex

6.用jd-gui查看效果

技术分享

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。