這是在工程中的proguard-project.txt中發現的
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-15
proguard.config=proguard.cfg
Android代碼混淆,如何過濾掉反射的R文件及第三方包?
解決方案:在Proguard.cfg方件中添加以下設定:
- 過濾R文件的混淆:
-keep class **.R$* { *; }
- 過濾第三方包的混淆:
-keep class packagename.** {*;}(其中packagename為第三方包的包名)
Android導入第三方jar包,proguard混淆腳本(屏蔽警告,不混淆第三方包)
最近1個項目中 需要導入移動MM的第三方計費包,混淆時用到了如下腳本,可屏蔽警告,不混淆第三方包指定內容。
非常有效
proguard.cfg 文件
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-ignorewarnings //這1句是屏蔽警告,腳本中把這行注釋去掉
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
//這1句是導入第三方的類庫,防止混淆時候讀取包內容出錯,腳本中把這行注釋去掉
-libraryjars libs/mmbilling.jar
-dontwarn //dontwarn去掉警告
-dontskipnonpubliclibraryclassmembers
-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
-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 *;
}
//這4句是不混淆第三方包中的指定內容,腳本中把這行注釋去掉 -keep class com.ccit.** {*; }
-keep class ccit.** { *; }
-keep class com.aspire.**
-keep class mm.vending.**
由www.J2meGame.com整理,轉載請說明。
================更多內容推薦===================================
如何反編譯APK
http://www.eoeandroid.com/thread-90027-1-1.html
Android一體化的反編譯工具
http://www.eoeandroid.com/thread-62036-1-1.html
轉自http://www.eoeandroid.com/thread-160335-1-1.html