Blank GoogleMap on a real Android 2.3 device with Google API (Lv. 17)

后端 未结 5 1688
星月不相逢
星月不相逢 2020-12-06 13:25

Question Description, Please read this first

I am trying to get my simple app which will display user\'s location running on devices from Android 2.3 to Android 4.

5条回答
  •  [愿得一人]
    2020-12-06 14:20

    OK, after hours of hours of thinking and trying, I think I can mark this problem as fixed.

    The problem is caused by the Wrong Date & Time in the 2.3 device.

    The time and date on 2.3 device is reset to 2013/01/01 due to out of power for a long time(as you can see in the log output, it shows 01/04 as date). And that can also explain why running with the same code, the Google Maps V2 didn't show up on 2.3 device but will show up on 4.0+ device (because the 4.0+ device I'm using has the correct time).

    I think because of the huge difference of date and time between this device and the Google Maps server, the communication between them got malfunctioned (don't know exactly why, but it should be some timestamp stuff).

    When I manually set the date and time of the 2.3 device to the current time, the problem got solved immediately.

    This problem is so weird and the logout just showing like:

    Could not find class 'maps.i.k', referenced from method maps.z.ag.a

    is so ambiguous that makes me very hard to think about the problem is caused by wrong date & time on the device.

    So next time if you encountered something wrong while playing around with Google Maps API, please follow this steps to check:

    • Check if your devices' date & time settings correspond to your current time zone (Unfortunately the log output will not return much constructive information to lead you to think about the date & time)
    • Check if you've enabled the correct service in your API console (Enable Google Maps API Android V2 not Google Maps API V2, log will return Authentication Failed if you do something wrong with this step)
    • Check if you've used the correct keystore to get the API secret (The log will give you a hint saying Authentication Failed
    • Check if you've included the correct library files

    Thanks for anyone who tried to help me, and I hope this question & solution can help others.

提交回复
热议问题