Error Inflating class com.google.android.maps.MapView

zeshu picture zeshu · Jul 1, 2011 · Viewed 28.2k times · Source

i am just following a simple map tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html but getting this error . I am new to android i tried to follow all the solution provided over the internet but no success yet. Please help me. My main .xml is below

<?xml version="1.0" encoding="utf-8"?>
<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="fill_parent"
    android:clickable="true"
    android:apiKey="***"
/>

and manifestfile is this

Answer

Bobs picture Bobs · Oct 4, 2011

I had this problem and solved it by the following 2 steps:

1) Put the following line in the application (important) element of AndroidManifest.xml file.

<uses-library android:name="com.google.android.maps" />

2) extend MapActivity instead of Activity.

enjoy!