2

This code shows unbound exception,i tried all combinations.. cant ressolve !!

    <com.google.android.maps:MapView
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"       
     android.apikey="AIzaSyDIqLvjKi_VM7nT1DUSTzIeKDTuzPGFqrQ"/>

The entire code is:

    <?xml version="1.0" encoding="utf-8"?>
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" >  
     <com.google.android.maps:MapView
      android:id="@+id/map1"    
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"    
      android:apikey="AIzaSyDIqLvjKi_VM7nT1DUSTzIeKDTuzPGFqrQ"/>
     </RelativeLayout>
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
Gyanesh Gouraw
  • 1,991
  • 4
  • 23
  • 31

3 Answers3

3

You need this

 xmlns:android="http://schemas.android.com/apk/res/android"

in your root element of xml

    <?xml version="1.0" encoding="utf-8"?>
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" >  
     <com.google.android.maps.MapView // :MapView is .MapView
      android:id="@+id/map1"    
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"/>    
     </RelativeLayout>

Also

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="api key"/>
// android.apikey

must be in application tag of manifest file

You can find an example

Android - android.view.InflateException: Binary XML file line #8: Error inflating class fragment

Reference

https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2

Community
  • 1
  • 1
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
2

You defined wrong Mapview <com.google.android.maps:MapView you added. : before MapView and that is wrong. You must replace : with .. it's like below:

<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
/> 

and also add API key into application tag in manifest like below:

<meta-data
  android:name="com.google.android.maps.v2.API_KEY"
   android:value="your api key"/>
M D
  • 47,665
  • 9
  • 93
  • 114
0

Replace android.apikey with android:apikey

May it helps..

Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138