Android Google Maps: XML layout errors
Asked Answered
F

2

0

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:

<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:

enter image description here

Fossil answered 24/8, 2013 at 14:37 Comment(2)
you need to include the google play services library.Dorettadorette
see my answer maybe helpful.Dorettadorette
M
1

This happens to me as well. Simply clean the project.

Magnuson answered 24/8, 2013 at 14:47 Comment(2)
I am not familiar with Android Studio but for eclipse its Project-> clean. You may want to follow these instructions. #17135599Magnuson
a tutorial i found said rebuuild is the same as clean in android studio but it did not fix my problemFossil
C
-1

hi you must use this code in xml file :

<?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"/>
Carhop answered 24/8, 2014 at 22:51 Comment(1)
This looks pretty much identical to the fragment in the question.Chemiluminescence

© 2022 - 2024 — McMap. All rights reserved.