Question

I just used the new ProGuard tool in eclipse to obfuscation my application. The I decompiled it using dex2Jar and JD-GUI to inspect what happened.

I noticed that everything from the R class has been converted to a random number like the following.

new SimpleCursorAdapter(localActivity, 2130903058, localCursor, arrayOfString, arrayOfInt);

2130903058 was a layout file. Strings an arrays get the same treatment.

There is no R class in the decompiled code, where has it gone? Where are the references to the original strings?

Was it helpful?

Solution

All references are integers. If you look at R.string, you'll notice all the members are ints. This is because they are pointers to the actual strings. For example, android.R.string.cancel is always 17039360, which points to the string Cancel. What ProGuard does is it replaces these references with the actual numbers they represent, so if you use android.R.string.cancel, it will replace it with 17039360.

Edit: There is no R class because it is not needed anymore (all references to it have been replaced).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top