i want to obfuscate AndroidManifest.xml with Progu

2019-07-04 02:34发布

问题:

Can i obfuscate AndroidManifest.xml file with Proguard?

i think write to source code in my proguard.config file. (-adaptresourcefilenames AndroidManifest.xml)

but it wasn't work.

回答1:

The standard Android release builds only apply ProGuard to the compiled bytecode, not to any resource files. It therefore can't adapt files like AndroidManifest.xml.

Moreover, these build processes first run aapt to convert AndroidManifest.xml and other XML files to binary versions, for more efficient packaging and use. Aapt also writes out some configuration for ProGuard. ProGuard can only parse and adapt resource files in text format, so it wouldn't work on the binary versions.

DexGuard, the commercial extension of ProGuard that specifically targets Android, streamlines the build process. It also obfuscates and optimizes the binary XML files, as far as possible. As Nikolay mentioned, some class names still can't be obfuscated; notably the ones that may be referenced from other apps.

(I am the developer of ProGuard and DexGuard)



回答2:

You can't: the system needs to know about your components (activities, services, etc.) You can't obfuscate the names of components references in the manifest either. The default ProGuard configuration excludes those explicitly.