Blnpwr
Blnpwr

Reputation: 1875

How to obfuscate API KEYS in AndroidManifest Android

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?

Upvotes: 0

Views: 1801

Answers (1)

Franklin Hirata
Franklin Hirata

Reputation: 288

  1. Put your google key into .xml file. Never place restricts strings into AndroidManifest file
  2. 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.

Upvotes: 1

Related Questions