开发者

Android Strings turn to random number after proguard Obfuscation

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 trea开发者_开发问答tment.

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


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜