Step-by-step use of Android code on the phone - line number mismatch

I'm trying to debug some ListView related code on a Samsung Captivate (Galaxy S). I set a breakpoint somewhere in my code, and when it stops, I return to the stack a few frames to the ListView source.

Now I can expect that there will be some inconsistency, since my phone probably has a slightly different version of the Android classes than the source code that I use in my IDE. However, I get a mismatch of more than 300 lines. I do not see this discrepancy in the emulator.

Moreover, the stack trace shows the line number of the 3688 list for the performItemClick () method, while the ListView source has only 3644 lines, and this method appears in it on line 3395. I looked at different versions of Android code, and not one of them does not execute the function ItemClick () much closer to line 3688.

The only explanation I can think of is that Samsung has changed the Android code a lot, but I don’t understand why they will make such changes.

Is there any other reason I'm absent? Is there a way to get the debugger to automatically adjust the lines, because currently I just can't go through this code?

+6
source share
3 answers

Trying different versions will not help. Samsung changes its framework code and does not release changes. I ran into the same issue with my Samsung Charge smartphone. They probably relate to the galaxy as well. This is the failed reality of the Apache license.

When I contacted Samsung about the problem, I received the following answer (with minor changes):

FRG83 android-2.2.1_r1 - [right version number for Samsung Charge].

In addition, the file 'ListView.java' does not match between the file on the phone and the original google, because we modified it.

ListView.java is distributed under the Apache license, which is not required to publish source code.

Please understand that we only publish open source codes that are licensed and have an obligation to publish (e.g. GPL, LGPL, MPL ... etc.).

The reason for mentioning "Get Source for Android" is just to create our open source code.

+2
source

It is possible that there are differences in the encoding that lead to a change in the number of carriage returns. Try formatting the source with a single encoding and remove extra line breaks.

+1
source

I usually find that reading documentation is more productive than going through third-party code if you want to understand it. Especially with large frames. There is also a good video on ListView that I would recommend.

Saying this, sometimes even after you read the documentation, it still does not make sense and, if it is real, can help. The first thing to do is find out which version you have on your phone:

my phone may have a slightly different version of Android

and make sure your android source code connected to eclipse is the same version. If Android androids added new APIs to ListView , then you could see their size.

I would also be very surprised if Samsung changed these files.

0
source

Source: https://habr.com/ru/post/888724/


All Articles