2

Is there any way I can obfuscate the names of my Android activities? I would like to be able to hide them from view, if someone were to attempt to reverse engineer my APK. Of course, I could simply manually rename them all with nonsense names and change the manifest as well, but is there any other way?

pqn
  • 1,522
  • 3
  • 22
  • 33
  • As far as I know, you would have to manually rename them, because ProGuard doesn't know how to modify the Manifest. You also need to be careful about whichever Activity is tied to the launcher. If the launcher activity's name changes, I think it breaks users' shortcuts on the home screen. – Tenfour04 Aug 02 '11 at 00:51

1 Answers1

4

I think what you're looking for is ProGuard.

EboMike
  • 76,846
  • 14
  • 164
  • 167
  • 4
    I use that already, but by default you have to keep all classes that extend `Activity` since this might screw up the manifest, or so I think. In that case, can anyone explain the whole ProGuard situation? The rest of my application is pretty well obfuscated. – pqn Aug 02 '11 at 00:52
  • 1
    Well, you need to keep the activity names around since they need to be matched up with the manifest, and other apps are theoretically able to trigger your activities by writing out the class name in the intent. What exactly are you trying to prevent? – EboMike Aug 02 '11 at 00:55
  • I don't want people to be able to reverse engineer some of my main code, much of which resides inside the activities. Now that I think of it, I should probably externalize it to separate classes, so I suppose that resolves my problem :D – pqn Aug 02 '11 at 00:57
  • I just realized that the code within the class is still obfuscated, just not the name of the class. Sorry, head's fuzzy at the end of the day... – pqn Aug 02 '11 at 01:07
  • I was thinking about making a simple bash script to rename the activity classes that are not marked as public in the manifest. It should be a simple task... – slott Jul 07 '13 at 13:36