Skip to content Skip to sidebar Skip to footer

Setcontentview Shows Number; How Can I Find Layout After Decompile Code?

I have decompiled an apk code by using apktool. The code which I got contains setContentView(2130903087); My question is how can I find the layout name from this line.

Solution 1:

At first convert this decimal number into hexadecimal. Then,after decompile the dex file, you will get R.java file inside your decompiled code. In that search for the hexadecimal number, you will get the layout file.

Solution 2:

Apktool uses smali to disassemble applications. The code line you wrote was not produced by apktool.

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

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" />

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

There we have it.

Post a Comment for "Setcontentview Shows Number; How Can I Find Layout After Decompile Code?"