I am trying to get google maps v2 to work in android using android studio. I got all my keys and manifest setup. When I try and create xml for the actual activity that the map will show up on I get errors. My xml looks like this:
我试图让谷歌地图v2使用Android工作室在Android工作。我得到了所有的密钥和清单设置。当我尝试为地图将显示的实际活动创建xml时,我会收到错误。我的xml看起来像这样:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<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"/>
</RelativeLayout>
My error in android studio looks like this:
我在android studio中的错误看起来像这样:
2 个解决方案
#1
1
This happens to me as well. Simply clean the project.
这也发生在我身上。只需清理项目即可。
#2
-1
hi you must use this code in xml file :
您好,您必须在xml文件中使用此代码:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
#1
1
This happens to me as well. Simply clean the project.
这也发生在我身上。只需清理项目即可。
#2
-1
hi you must use this code in xml file :
您好,您必须在xml文件中使用此代码:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"/>