Excluding manifest file from obfuscation

1.9k Views Asked by At

Is there a way to prevent AndroidManifest.xml from being obfuscated by DexGuard? It seems that MobileIron has some troubles with obfuscated manifest of our Android application. It processes a "plain" application just fine, but throws an error at the manifest of an obfuscated app.

Edit:

I just noticed the xmlstrings table of the obfuscated app is missing a bunch of strings:

aapt d xmlstrings c:\dev\app_obf.apk AndroidManifest.xml

String pool of 119 unique UTF-16 non-sorted strings, 119 entries and 0 styles using 5112 bytes:
String #0: 
String #1: 
String #2: 
String #3: 
String #4: name
String #5: 
.
.
String #18: versionCode
.
.
(up to String #25, then it is the same as in plain app)

Whereas the plain app's listing is following:

aapt d xmlstrings c:\dev\app.apk AndroidManifest.xml

String pool of 119 unique UTF-16 non-sorted strings, 119 entries and 0 styles using 6744 bytes:
String #0: versionCode
String #1: versionName
String #2: minSdkVersion
String #3: targetSdkVersion
String #4: name
String #5: required
String #6: hardwareAccelerated
String #7: icon
String #8: label
String #9: debuggable
String #10: value
...

Could that play a role or is it a normal behavior?

Both plain and obfuscated version of the app run just fine on devices.

2

There are 2 best solutions below

3
On

add the following to your DexGuard config --keepresourcefiles AndroidManifest.xml however AFAIK this is in the default DexGuard config.

Maybe its something else that MobileIron is not liking? Might be worth posting your DexGuard config or raising support issue with MobileIron.

1
On

If someone still struggling with this, this line solved the problem to me:

-keepresourcexmlattributenames manifest/**