Android 字符串在 proguard 混淆后变成随机数

发布于 2024-10-07 08:50:44 字数 450 浏览 0 评论 0原文

我刚刚在 eclipse 中使用了新的 ProGuard 工具来混淆我的应用程序。我使用 dex2JarJD-GUI 检查发生了什么。

我注意到 R 类中的所有内容都已转换为随机数,如下所示。

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

2130903058 是一个布局文件。字符串和数组得到相同的处理。

反编译后的代码中没有R类,它去哪儿了?对原始字符串的引用在哪里?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初与友歌 2024-10-14 08:50:44

所有引用均为整数。如果您查看 R.string,你会注意到所有成员都是int。这是因为它们是指向实际字符串的指针。例如,android.R.string.cancel 始终为 17039360,它指向字符串 Cancel。 ProGuard 的作用是将这些引用替换为它们代表的实际数字,因此如果您使用 android.R.string.cancel,它会将其替换为 17039360

编辑:没有 R 类,因为不再需要它(对它的所有引用都已被替换)。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文