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

岁酱吖の 提交于 2019-11-28 00:13:57

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.

This is the common problem occured in google Map using Api v2.The main reason in google play serviceis if the google play service is updated then only the mapview will display.The problem can be solved if you run the app in device.So better try in device it will work for you!!

crocboy

Check out this related question: Google Maps on Android blank space

It looks like the change from v1 to v2 makes it hard to get a new API key, and in v2 the keys are stored in the manifest. Let me know if this works.

Bhavesh Patadiya

OK. i think below link will help you somewhat as it also saved me too having this same issue. Though i am not sure as you are not getting any problem inside API level 4.0+ version

google-maps-v2-shows-blank-screen-on-android-2-2

Problem may be because of Debug.keystore

Solution : Make Sure you are debuging your App with the same keystore with which you have created your SHA-1 code for getting yout API key.

let say you are using Ubantu and opening your Eclipse as root then whenever you will building your app eclipse will use default.keystore inside to run your app in device located in root/.android/debug.keystore so when you are creating your API key you have to make Sure you are using the same Keystore with which you will build you app.

Hope it will help you.

Add both permission into AndroidManifest.xml file:

<permission
 android:name="YOUR_PACKAGE_NAME.permission.MAPS_RECEIVE"
 android:protectionLevel="signature"/>
<uses-permission android:name="YOUR_PACKAGE_NAME.permission.MAPS_RECEIVE"
 android:protectionLevel="signature"/>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!