-2

I have created one android app but in that app i am using url,so i want to protect that url because when i decompiled my apk,inside java class url is coming as it is.

so i want to ask that is this possible to protect that url ?

Ashish Kumar Pal
  • 347
  • 2
  • 15

3 Answers3

1

No, there is no way to prevent people from seeing any data you include in the apk. You should not include secret data inside the code. Obfuscation barely helps - it just gives you a false sense of security.

Antimony
  • 37,781
  • 10
  • 100
  • 107
0

Store url in Native lib file and get at where you want,Do this You need NDK

-2

Just mark minifyEnabled true in build gradle file in buildTypes release mode. It will make apk not view source and decomile.

Example: Add follwing lines in gradle file:

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

    }
    //added by me
    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

    }
}
Rahul Vats
  • 277
  • 3
  • 17
  • You must add that adding proguard only isn't a full proof method, there are tools which will decompile an APK even if it is obfuscated. – Rohan Kandwal Sep 12 '16 at 08:23
  • Adding ProGuard will not prevent decompilation of the apk. If you want to protect against this and also encrypt strings inside your application, you should check DexGuard, the commercial variant of ProGuard. – T. Neidhart Sep 12 '16 at 09:55