Reputation: 51
I have hardcoded string (APIkey) in my Java code (APK) but it can be easily decompiled by many tools. I know I can protect by encryption. But what if the hacker decompile my Java and find out the encryption and decryption code? Is there any better way to do that?
Upvotes: 2
Views: 1182
Reputation: 726
You should add your keys in build.gradle file. These files are not included in your apk. Infact these are just used to sign your application and create a release build.
signingConfigs {
release {
storeFile file("../myapp.jks")
storePassword "mypassword"
keyAlias "My_App"
keyPassword "mykeypassword"
}
debug {
storeFile file('../debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug{
debuggable true
minifyEnabled false
signingConfig signingConfigs.debug
}
}
Upvotes: 1