当前位置:操作系统 > 安卓/Android >>

Android 混淆打包

修改project.properties文件
 
[html]  
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt  
 
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
去掉之前的#,即取消注释
 
 
 
 
修改proguard-project.txt文件(忽略第三方jar)
引入第三方库:
 
-libraryjars /libs/umeng_sdk.jar
 
忽略类:
 
-keep class com.umeng.** {*;}
 
 
 
 
 
 
[java]  
-optimizationpasses 7  
-dontskipnonpubliclibraryclasses  
-dontskipnonpubliclibraryclassmembers  
-dontpreverify  
-verbose  
-allowaccessmodification  
-repackageclasses   
-dontusemixedcaseclassnames  
-dontoptimize  
  
-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  
  
  
-libraryjars /libs/umeng_sdk.jar  
  
-keep class com.umeng.** {*;}  
  
-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 *;  
}  
 
-optimizationpasses 7
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-allowaccessmodification
-repackageclasses 
-dontusemixedcaseclassnames
-dontoptimize
 
-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
 
 
-libraryjars /libs/umeng_sdk.jar
 
-keep class com.umeng.** {*;}
 
-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 *;
}
 
 
 
配置好混淆,最后打包项目: 
 
\
 
 
 
 
 
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,