How to implement Google Maps new version of API v2

前端 未结 6 1644
滥情空心
滥情空心 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:11

    Be sure to name your main activity as you declare it in manifest:

    Caused by: java.lang.ClassNotFoundException: com.example.apv.MyMapActivity
    

    Maybe a package naming issue? Post your entire MyMapActivity, not only the onCreate.

    0 讨论(0)
  • 2021-02-08 14:13

    If you want to use fragments then your activity i.e your MainActivity should extend FragmentActivity

    0 讨论(0)
  • 2021-02-08 14:26

    check out this youtube tutorial video. It is for beginners and will help you in creating a simple Google Maps V2 app from scratch youtube link. And as far as running Google Maps V2 on eclipse emulator is concerned see this answer Running Google Maps v2 on emulator

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-08 14:35

    Following this guide found on a similar post may be able to help, you need to install 2 .apk files. Source: http://nemanjakovacevic.net/blog/2012/12/how-to-make-android-google-maps-v2-work-in-android-emulator/

    0 讨论(0)
  • 2021-02-08 14:35

    Project properties -> Android -> Add... under Library and pick the google-play-services_lib that you added as a library project earlier according to these instructions:

    https://developers.google.com/maps/documentation/android/intro

    0 讨论(0)
提交回复
热议问题