I would like to add something to an app, so I added some lines to a smali file (decompiled the apk using apktools) and then repackaged and ran it on a real device. It shows
- 10121 10211 E AndroidRuntime: os.json.JSONObject a.b.a.a.a.i.m(android.context.Context, java.lang.String) Failed to verify: os.json.JSONObject a.b.a.a.a.i.m(android.context.Context, java.lang.String): [0x161] v0 has type Conflict but expected Reference: java.lang.AutoCloseable (declaration of 'a.b.a.a.a.i' in /data/app/xxxx/xxxxx/base.apk)
So what does the [0x161] refer to? Is it a line number? 0x161 = 353 in decimal. So I checked the smali code, but the function a.b.a.a.a.i.m has less than 353 lines in smali, so there is no line 353 and I can not locate the error.
Neither does this function have enough lines in java (I used jadx to decompiled the generated apk).
So in which type of file can I locate the problem in file's line 353? Should I transformed the apk into some other format to find a line 353 to troubleshoot the error? Thanks in advance.
0x161should be the relative offset/address in bytes from the start of the method.In Jadx open the
Smalitab for the class you are interested in and selectShow Dalvik Bytecodefrom context menu of the smali code panel to see the offsets. The offset you are looking for should be shown in the second gray colored column (the one with the red border in the sample screenshot).And the error should be caused by placing a wrong object reference in
v0.