问题描述
我已经使用apktool反编译了apk代码.我得到的代码包含setContentView(2130903087);我的问题是如何从此行中找到布局名称.
I have decompiled an apk code by using apktool. The code which I got containssetContentView(2130903087);My question is how can I find the layout name from this line.
推荐答案
Apktool使用smali来反汇编应用程序.您编写的代码行不是由apktool生成的.
Apktool uses smali to disassemble applications. The code line you wrote was not produced by apktool.
让我们以一个示例应用程序并对它进行解码. (apktool d test.apk
).然后,让我们看一下我们知道正在使用setContentView
的文件.
Lets take an example application and decode it. (apktool d test.apk
). Then lets peek at a file that we know is using setContentView
.
const v0, 0x7f040037
invoke-virtual {p0, v0}, Lcom/android/deskclock/Screensaver;->setContentView(I)V
如您所见. v0
用等效于该布局的资源ID的十六进制填充.所以现在我们只需要grep
以获得该ID.
As you can see. v0
is populated with the hex equivalent of the resource id of the layout. So now we just need to grep
for that ID.
res/values/public.xml: <public type="layout" name="desk_clock_saver" id="0x7f040037" />
所以现在我们知道布局是desk_clock_saver
.这样我们就可以查看res/layout
.
So now we know that layout was desk_clock_saver
. So we can peek in res/layout
for it.
ibotpeaches@relic:~/test$ file res/layout/desk_clock_saver.xml
res/layout/desk_clock_saver.xml: XML document text
我们有它.
这篇关于setContentView显示数字;反编译代码后如何找到布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!