«

防止反编译所用到的proguard.cfg文件的编写

时间:2024-3-2 19:56     作者:韩俊     分类: Android


记录一下proguard.cfg在引入其他jar包时该如何编写,刚接触琢磨了好久

下面是我项目中用的proguard.cfg文件


-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

//从这里开始jar包的引入
-libraryjars libs/baidumapapi_v2_1_3.jar //jar包所在项目中的位置和文件名
-dontwarn com.baidu.* //jar包中的包名
-keep class com.baidu.** { *;}


-libraryjars libs/core.jar
-dontwarn com.google.zxing.*
-keep class com.google.zxing.** { *;}

//一个jar包中包含多个包都需要列出来,不然会报错
-libraryjars libs/ksoap2-android-assembly-2.5.2-jar-with-dependencies.jar
-dontwarn org.ksoap2.*
-keep class org.ksoap2.** { *;}
-dontwarn org.kobjects.*
-keep class org.kobjects.** { *;}
-dontwarn org.xmlpull.v1.*
-keep class org.xmlpull.v1.** { *;}
-dontwarn org.kxml2.*
-keep class org.kxml2.** { *;}


-libraryjars libs/locSDK_3.1.jar
-dontwarn com.baidu.location.*
-keep class com.baidu.location.** { *;}


-libraryjars libs/mframework.jar
-dontwarn m.framework.*
-keep class m.framework.** { *;}


-libraryjars libs/pinyin4j-2.5.0.jar
-dontwarn com.hp.hpl.sparta.*
-keep class com.hp.hpl.sparta.** { *;}
-dontwarn net.sourceforgepinyin4j.*
-keep class net.sourceforgepinyin4j.** { *;}
-dontwarn demo.*
-keep class demo.** { *;}


-dontwarn com.slidingmenu.**
-keep class com.slidingmenu.** { *;}


-libraryjars /libs/android-support-v4.jar
-dontwarn android.support.v4.**
-keep class android.support.v4.** { *; }
-keep public class * extends android.support.v4.**
-keep public class * extends android.app.Fragment
-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 com.android.vending.licensing.ILicensingService


-keepclasseswithmembernames class * {
native <methods>;
}


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


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


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


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

        <p>版权声明:本文为博主原创文章,未经博主允许不得转载。</p>

标签: android

热门推荐