How to show a map in an Android mapactivity?

我的梦境 提交于 2019-11-28 05:01:34

问题


I have attached a mapview to my layout and have a it showing a compass and my current location. The problem I have is, that there is no street map shown in the view, so basically I just see the compass and my current location over a blank grid.


回答1:


When you run or debug through Eclipse your app is signed with your debug key which will have been automatically created. It is not the same as the key you sign your app with when releasing it.

You need to get an API key using your debug key.

See the 'Getting the MD5 Fingerprint of the SDK Debug Certificate' section on http://code.google.com/android/add-ons/google-apis/mapkey.html

Once you are ready to release your app, you replace the debug API key with the API key you are currently using.




回答2:


Make sure you have the INTERNET permission and a proper API key. Either of those will give you the blank grid effect.

http://code.google.com/android/add-ons/google-apis/mapkey.html




回答3:


Turns out the map is only shown when the app is signed and uploaded using adb install {path to app}, the same app didn't work when I run or debug using Eclipse.




回答4:


Check out the followings: 1. include jar of maps. 2. generate your certificate and register it. It should work now :)



来源:https://stackoverflow.com/questions/1097594/how-to-show-a-map-in-an-android-mapactivity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!