当前位置: 代码迷 >> Android >> Android-搅混打包跟验证
  详细解决方案

Android-搅混打包跟验证

热度:87   发布时间:2016-04-28 01:00:52.0
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查看效果


  相关解决方案