adelphes / android-dev-ext

Android debugging support for VS Code
https://marketplace.visualstudio.com/items?itemName=adelphes.android-dev-ext
MIT License
211 stars 29 forks source link

Location variable returns Not a Number #104

Open lin88xu opened 3 years ago

lin88xu commented 3 years ago

Hi an issue occurred when I try to debug a application that uses Android.location.Location. When simulating using the avd, a breakpoint near the android Location variable shows that the latitude and longitude as NaN (Not a Number). May I know if this should be the case?

adelphes commented 3 years ago

Hi @lin88xu - thanks for reporting this. It looks the latitude and longitude values are stored internally as doubles in the Location object, initialised to zero, so it shouldn't be displaying them as NaN. I suspect one of the following is happening:

It would help if you could supply a small working example of the failure, or let me know a) if you're manually setting the location in the emulator settings and b) what you are expecting the values to be.

Thanks.

lin88xu commented 3 years ago

Hi adelphs,

Sorry for the late reply, took a while to replicate the error image From this screenshot, I have put a breakpoint on the onLocationChange method by android.Location.location object. I used the extended controls of the android emulator to create a dummy location, which shows up on the app as seen. However, the same numbers, latitude, logitude ect were not shown on the debugger, specifically the variable window or when I mouse over the loc object, as highlighted by the red circle

Is this behavior expected? Am I missing something when I launch my android emulator? I am launching it with the following command:

emulator.exe -avd Test -gpu host -netdelay none -netspeed full -feature WindowsHypervisorPlatform

Thanks!

adelphes commented 3 years ago

Thanks for the screenshot - this does look like a problem with the Android debugger. I will look into this a bit more and update you when I find out what is happening.