android混淆点滴知识

2015/04/29 00:41
阅读数 23

1.项目和混淆文件的路径不能有空格、中文

2.写好你的混淆配置文件

3.我的环境是4.0以上的


我的配置文件


-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify

-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-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.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-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*(...);
    public void get*(...);
}

-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>;
}

-keepclasseswithmembernames class * {
    native <methods>;
}

#-keepnames class * implements java.io.Serializable

-keep public class * implements java.io.Serializable {
	public *;
}

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

-dontwarn com.android.volley.jar.**
-dontwarn android.support.**
-dontwarn com.alibaba.fastjson.**

-dontwarn com.baidu.mapapi.**
-dontwarn com.baidu.platform.**
-dontwarn com.baidu.location.**
-dontwarn com.baidu.vi.**
-dontwarn vi.com.gdi.bgl.android.**
-dontwarn com.umeng.**
-dontwarn org.springframework.**
-dontskipnonpubliclibraryclassmembers
-dontskipnonpubliclibraryclasses


-keep class vi.com.gdi.bgl.android.**{*;}
-keep class com.alibaba.fastjson.**{*;}
-keep public interface com.umeng.socialize.**  
-keep public interface com.umeng.socialize.sensor.**  
-keep public interface com.umeng.scrshot.**  
-keep public class com.umeng.socialize.* {*;}  
-keep class com.umeng.scrshot.**  
-keep class com.umeng.socialize.sensor.** 
-keep class com.baidu.** { *; } 
-keep class com.google.**{*;}
-keep class com.cheshifu.model.**{*;}
-keep class com.android.volley.** {*;}
-keep class com.android.volley.toolbox.** {*;}
-keep class com.android.volley.Response$* { *; }
-keep class com.android.volley.Request$* { *; }
-keep class com.android.volley.RequestQueue$* { *; }
-keep class com.android.volley.toolbox.HurlStack$* { *; }
-keep class com.android.volley.toolbox.ImageLoader$* { *; }
-keep public class * extends android.widget.BaseAdapter {*;}
-keep class com.cheshifu.Adapter.**{*;}
-keepattributes Signature

#-libraryjars libs/alipaysdk.jar
#-libraryjars libs/alipaysecsdk.jar
#-libraryjars libs/alipayutdid.jar
-libraryjars libs/android-support-v4.jar
-libraryjars libs/androidannotations-api-3.0.1.jar
-libraryjars compile-libs/androidannotations-3.0.1.jar
-libraryjars libs/universal-image-loader-1.9.2.jar
-libraryjars libs/gson-2.2.4.jar
-libraryjars libs/android-async-http-1.4.5.jar
#-libraryjars libs/baidumapapi_v3_0_0.jar
#-libraryjars libs/core.jar
#-libraryjars libs/cu_volley.jar
#-libraryjars libs/fastjson-1.1.42.android.jar
#-libraryjars libs/locSDK_4.2.jar
-libraryjars libs/umeng-analytics-v5.2.4.jar
#-libraryjars libs/armeabi/liblocSDK4d.so 
#-libraryjars libs/armeabi/libBaiduMapSDK_v3_0_0.so

配置文件要根据具体项目  具体配置的,一般改动都不会太大。



参考了一些文章:

android 混淆语法

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部