4

I want to obfuscate my activity names. I do understand from the other questions that you cannot obfuscate activity names, even with ProGuard, because they are referenced by their names.

Though, if one could change the activity names before compiling, why cannot there be a way to auto change the activity names to predefined shady names using some script or maybe use some ProGuard rules to map the activity names to the predefined names.

For example, I could do the following:

MainActivity -> GibberishName

ProcessingActivity -> OtherGibberishName

I want to automate this task without having to change activity names on each build.

Thank you.

Kaleega
  • 127
  • 5
  • Could you add a little more information to the question title to give us some context? – Todd Palmer May 13 '18 at 23:31
  • There is a gradle plugin for that, you can check it here [https://github.com/eleme/Mess](https://github.com/eleme/Mess) i haven't tested it – Vaishakh Jun 10 '18 at 05:28

1 Answers1

-1

Put the below lines in your app level build.gradle file :

buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    } 

But still it wont obfuscate your activity name cause this is a normal behaviour.

Activity names are never obfuscated because these are referenced in manifest.xml and android access these activities via reflection so their names cannot be changed.

Check this link https://stackoverflow.com/a/20620108/1320616

Koustuv Ganguly
  • 897
  • 7
  • 21
  • I am using ProGuard but it does not obfuscate activity names. – Kaleega May 14 '18 at 05:11
  • Thanks for the effort, Koustuv. Please check my original question. I do know that ProGuard cannot obfuscate the activity names. Though, if you can change the activity names yourself including in the manifest. Why cannot there be a script to help you do that like that of a mapping between your activity names into your predefined shady names. That is my question. – Kaleega May 14 '18 at 05:40