码迷,mamicode.com
首页 > 移动开发 > 详细

Android-混淆打包跟验证

时间:2015-05-12 13:45:13      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:

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查看效果

技术分享

Android-混淆打包跟验证

标签:

原文地址:http://blog.csdn.net/qq285016127/article/details/45667023

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!