3

I just decode one apk file, but issue is that I can't get the R.java file.

The R.java file is created automatically in the application, but when the apk file is decoded, it gives the hex value that is created in R.java instead of @string/abc or @color/white etc ....

When we create string or color or any other resources in the application, android platform assigns some hex value to that string or color in R.java, so when we decode the apk file, it gives that hex value, so how can we decide that particular hex value is for that string or color ?

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Jayesh
  • 3,661
  • 10
  • 46
  • 76

3 Answers3

11

You cannot directly extract r.java file, but the contents of r.java file can be extracted using 'aapt' tool. The following command lists all resources and their respective ID's as present in r.java file:

aapt d resources name_of_apk
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Phani
  • 131
  • 1
  • 3
3

The R class consists of nested classes, each of which consists consists entirely of compile-time constants. If the .apk file was obfuscated by ProGuard (which will be true of pretty much all published apps), all this will have been optimized away. There's no way to recover it.

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
2

Download android-apktool , extract all in the same directory and run

apktool d app.apk
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Nirav Ranpara
  • 13,753
  • 3
  • 39
  • 54