03-23-2016, 04:57 AM
(03-10-2016, 08:29 PM)AlexM20 Wrote: Why I get like android:id="@id/textView1" in xlm and findviewbyid (3523423) in java in Bytecodeviewer?
When developing an android app the buildsystem generates a class called R.java which holds all references to stuff defined in resource files (like xml files) in static members. The compiler is able to eliminate all references to the R.class by directly using static values defined in this class when building the apk. This is why you just see calls like findViewById(0x1234567 after decompilation. The mapping between identifiers and static values gets saved in the compiled resources file resources.arsc.
I would suggest you use apktool (http://ibotpeaches.github.io/Apktool/) to get the link between identifiers and layouts. apktool is able to generate a xml file which holds the needed information from the compiled resources. You can find all identifiers in a file called public.xml in <targetapp>/res/values/public.xml after decompilation.
Just as an example: activity_layout.xml
Code:
...
<ImageView android:id="@id/oneupDrawable" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="80.0dip" android:src="@drawable/oneup" />
...
public.xml
Code:
...
<public type="drawable" name="oneup" id="0x7f020045" />
...
<public type="id" name="oneupDrawable" id="0x7f0c0053" />
...
activity.smali
Code:
const v4, 0x7f0c0053
invoke-virtual {p0, v4}, Lde/some/app/activity;->findViewById(I)Landroid/view/View;
Hope that will help you!
Regards, mik