3

I am using Dexguard in my app and I want to obfuscate a class which extends Activity class, I get to know that it is hard because it is referenced in Manifest file. My question is: is there any way to obfuscate a class which it is referenced in Manifest file?

Jinesh Francis
  • 3,377
  • 3
  • 22
  • 37
MrDEV
  • 3,490
  • 1
  • 19
  • 20
  • Why wouldn't you be able to obfuscate it? You can obfuscate it like any other class. The only thing you can't do is change the class name or the package name, as long as those stay the same you are not going to have any problems. – Xaver Kapeller Dec 29 '16 at 12:54
  • Actually as I can see, all classes which are referenced in Manifest file are not totally obfuscated, even though it is OK for me, but still I need to change the class name and package name. – MrDEV Dec 29 '16 at 12:58
  • @XaverKapeller Is there any method to do that? – MrDEV Dec 29 '16 at 13:00
  • 1) You can't. 2) What would that improve? There really is no point to it. IMHO there is no point to obfuscation in general... – Xaver Kapeller Dec 29 '16 at 13:00
  • @XaverKapeller Disclosing the class name or package name will indicate to the implementation and the app behaviour. That's why I wanted to hide them. – MrDEV Dec 29 '16 at 13:03
  • Well as I already said: you can't. Classes referenced in the manifest have to keep their class name and package name. And secondly just because your MainActivity is now called zzArb or something like that is not going stop anyone. It's barely any hurdle at all. – Xaver Kapeller Dec 29 '16 at 13:09
  • @XaverKapeller Thank you so much for this clarifications. – MrDEV Dec 29 '16 at 13:41

3 Answers3

2

Wherever possible, DexGuard obfuscates the names of classes, fields, methods, resources, resource files, asset files, and native libraries, and it adapts their occurrences in the code, the manifest, and other resources. More specifically, DexGuard indeed obfuscates the names of activity classes and updates the manifest accordingly. However, it won't obfuscate the names of activities that are exported, either explicitly (exported="true") or implicitly (with an intent filter). The Android runtime treats these names as public API, e.g. visible to other apps, so they need to be preserved.

Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106
  • I triecd using -applymapping feature.. but in may mapping file I am getting below error "ProguardTokenType.CRLF, ProguardTokenType.FLAG_NAME, ProguardTokenType.LINE_CMT or ProguardTokenType.WS expected, got 'c'" My mapping file has just one line : "com.android.appname.TermsAndPrivacyActivity -> com.android.dex.f:" – Pankaj Kushwaha Mar 28 '17 at 13:01
0

You can obfuscate a class which is referenced in Manifest file by using this tool: Bg+ Anti Decompiler (JAVA) It's free to use.

0

Dexguard will not obfuscate a activity class if in manifest it have intent filter and exported true. if you want to obfuscate class use make your class exported false.