问题
I discovered ProGuard
and I managed to get my code obfuscated. It works. Amazing tool.
But what ProGuard didn't obfuscate is the AndroidManifest.xml
. I have a Google Maps API Key in my Manifest.
I "secured" this API KEY in Google Developer Console using my package name and SHA-1 fingerprint.
Is it recommended to obfuscate the api key in Manifest anyway? If so, how can I achieve this with ProGuard
?
回答1:
- Put your google key into .xml file. Never place restricts strings into AndroidManifest file
- Try using Dexguad
On your Dexguard file, use the commands bellow
-encryptassetfiles res/values/**
(if you are using gradle job to get your environment parameters)
-encryptstrings class my.package.Environment.class
regards.
来源:https://stackoverflow.com/questions/46475140/how-to-obfuscate-api-keys-in-androidmanifest-android