0

I've created my app and following the suggestions here I've done this:

In 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

Those are the class on my manifest

In project.properties uncomment the line:

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

I've exported my app and opened used dex2jar and jd-gui to see if add any success.

The problem is that the code is almost as I've coded and is very easy to understand.

Am I doing something wrong? Can I improve the obfuscation?

Community
  • 1
  • 1
Favolas
  • 6,963
  • 29
  • 75
  • 127

2 Answers2

1

You should have copied the 'keeps' literally as in

-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

rather than substituting your own actual activity names

NickT
  • 23,844
  • 11
  • 78
  • 121
  • Thanks. Done that but the result is the same :( – Favolas Aug 30 '12 at 15:35
  • I still have my Proguard configuration in the proguard.cfg file and to turn Proguard on, I have the line proguard.config=proguard.cfg in project.properties. (I don't know whether these are the currently recommended names though! Plus I only do release builds using Ant, just using Eclipse for the debug builds) Sorry it didn't work for your configuration – NickT Aug 30 '12 at 15:51
  • Ok. Changed `proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt` to `proguard.config=proguard-project.txt`. Its seams to be better, nevertheless its relatively easy to understand the code. Thanks NickT – Favolas Aug 30 '12 at 18:08
1

Ok.

I've removed the lines:

-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

And now its as I expected

Since all examples on the internet have those lines I tough they were important.

Testing my app and it is working as expected

Favolas
  • 6,963
  • 29
  • 75
  • 127