2012-08-30 75 views
0

我創建我的應用程序並按照建議here我已經做到了這一點:的Android應用程序保護使用ProGuard

在proguard的-project.txt:

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

-optimizationpasses 10 
-dontwarn android.support.** 
-verbose 


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

-keep public class ClassOne extends Activity 
-keep public class ClassTwo extends ListActivity 
-keep public class ClassThree extends ListActivity 
-keep public class ClassFour extends ListActivity 
-keep public class ClassFive extends ListActivity 
-keep public class ClassSix extends ListActivity 
-keep public class ClassSeven extends Activity 

這些都是階級對我manifest

在project.properties取消註釋行:

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 

我導出了我的應用程序並打開了使用的dex2jar和jd-gui,以查看是否添加了任何成功。

問題是,代碼幾乎和我編碼一樣,而且很容易理解。

我做錯了什麼?我可以改進混淆嗎?

回答

1

你應該已經複製了「保持」字面上作爲

-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 
-keep public class * extends android.support.v4.app.Fragment 
-keep public class * extends android.app.Fragment 

而不是替代自己的真實姓名活動

+0

謝謝。做到了,但結果是一樣的:( – Favolas

+0

我仍然有我的Proguard配置在proguard.cfg文件中,並打開Proguard,我有project.properties中的proguard.config = proguard.cfg 行(我不' t知道這些是否是當前推薦的名稱!另外,我只使用Ant進行發佈版本,只是使用Eclipse進行調試版本)對不起,它不適用於您的配置 – NickT

+0

好吧,更改'proguard.config = $ {sdk。 dir} /tools/proguard/proguard-android.txt:proguard-project.txt到'proguard.config = proguard-project.txt'。它的接縫更好,但它相對容易理解代碼。 – Favolas

1

確定。

我已經刪除了行:

-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 
-keep public class * extends android.support.v4.app.Fragment 
-keep public class * extends android.app.Fragment 

而現在是如我所料

由於在互聯網上所有的例子有那些行我艱難的,他們是很重要的。

測試我的應用程序,它按預期工作