How to implement Google Maps new version of API v2

前端 未结 6 1663
滥情空心
滥情空心 2021-02-08 13:40

Hi every one I came to know that google maps has deprecated its previous version API v1 and introduced a new version of google maps API v2. I tried out one example by followin

6条回答
  •  时光说笑
    2021-02-08 14:33

    The code you provided contains errors. Your activity name is MainActivity but in the manifest file, the only activity you declared has the name MyMapActivity. Also your manifest file doesn't have a opening application tag.

    Correcting these two errors, I've run your code and got the exception you mentioned. I fixed the problem by adding the google-play-services library project. I think you forgot to add this or it's not correctly added. You can find details on it in the developer doc of google map v2.

    To check this, right click on your project and go to properties. Then select Android from left. At the bottom of this page, you'll find the library projects table. Make sure the google-play-services library project is in the list and have a green mark. If it's not there, add it by clicking the right "Add.." button.

    Sometimes, eclipse fails to add library project which is not in the same workspace of your project. If this is your case, keep the google-play-services and your project in the same workspace and then try again.

提交回复
热议问题