Android - Google Maps API v2 - SupportMapFragment Errors

人走茶凉 提交于 2019-11-30 17:37:19
Paul Wein

You need to extend FragmentActivity if you are using SupportMapFragment. If you are using the MapFragment you can extend Activity.

In your layout, use

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/map"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              class="com.google.android.gms.maps.SupportMapFragment"/>

instead of

...    
android:name="com.google.android.gms.maps.SupportMapFragment"
...
Jovan

You must do this:

public class MainActivity extends android.support.v4.app.FragmentActivity{

}
uncle Lem

This worked for me: https://stackoverflow.com/a/13744765/1215098

Seems like you have to add Google Play services as module, not just as .jar

I solved this error by checking "Copy projects into workspace" while importing the Google Play Services lib.
More info here: http://developer.android.com/google/play-services/setup.html

i had the same problem with Google Play Services and everything.. i included as a library and all, and the problem still persisted ("could not find com.google.android.gms.maps.suportmapfragment")..

i was able to fix it by: Going to Project Properties. Then select Java Build Path. Then Select Order and Export tab. then, Make sure you check the Android Dependencies and Android Private Libraries

Hope this helps :)

I've added <uses-library android:name="com.google.android.maps" /> in the manifest file. This worked for me!

I think i had the same problem it seems that newer versions you have to add this line at the manifest

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

My case, I add:

File -> New -> Google -> Google Maps Activity

And i follow this tutorial.

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