0

I'm using ProGuard for the first time. I have all my activities, fragments, list fragments, and the like inside the root package of my project (I tried to move them but made no difference). I'm using the standard proguard-android.txt plus the proguard-project.txt where I can put anything I want, it makes no difference to these classes, because they are just ignored.

They're not listed in usage.txt,seeds.txt, mapping.txt or dump.txt, and they're not in the dex (library classes seem to be correctly treated though).

I tried with -keep public class <my.project.rootpackage>.MyActivity one for every ignored class, and many other things, the last one is:

-dontshrink
-dontoptimize
-dontobfuscate

-keep public class * extends android.app.Application
-keep public class * extends android.support.v4.app.FragmentActivity
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.support.v4.app.ListFragment
-keep public class * extends android.preference.PreferenceActivity

I could be using a simpler project while learning, but I don't see why it shouldn't work, after all ProGuard seems to handle well the libraries. Of course, the project works well when built in debug mode.

ProGuard updated to v4.8, Eclipse 3.7.2, ADT and SDK updated, project target API 15, no messages from ProGuard.

What am I missing? I admit I've never had clear the build process. Do I have to learn Ant?

EDIT: when it doesn't work (that is, ProGuard finishes with an error), I often get this kind of errors:

Warning: my.project.package.ClassA: can't find referenced class my.project.package.ClassB

Note that the two classes can also be in the same package.

bigstones
  • 15,087
  • 7
  • 65
  • 82

1 Answers1

0

So it seems that the ignored classes are due to the fact that the "Build Automatically" feature prevented ProGuard from doing its job. With that unchecked, the "export signed application package" procedure goes well, but ProGuard is not obfuscating/shrinking. But this makes for another question.

References: Why start using -libraryjars when I never needed it before?

...EDIT: actually it's just the apk in project's bin that is not shrinked. The exported APK is fine. What an odyssey.

Community
  • 1
  • 1
bigstones
  • 15,087
  • 7
  • 65
  • 82