You can encrypt API keys and other sensitive data. Here is a great article. The most sensitive thing is the password that will be used to generate the symmetric key. And it is important (yes, the same problem again) that this password is not hardcoded in the code, but in order to calculate it at runtime. One of the good parts for calculating it is APK certificate data ( Get apk signature at runtime for Android ). This is likely to make the work of the reverse engineer a little more complicated. But dynamic analysis will help him / her get the secret key.
The server side calculation method is also very useful here, especially in combination with the previous tip.
Thus, part of the key is generated at runtime, and the other part must be received from the server after successful user authentication. Just an example.
But the easiest way is to use commercial obfuscators that support string / dex-bytecode encryption like DexProtector
NB I am affiliated with Licel (DexProtector developer)
Ivan Kinash
source share