Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 298
zeshu Avatar asked Jul 01 '11 07:07

zeshu


People also ask

What is Mapview in Android?

A View which displays a map (with data obtained from the Google Maps service). When focused, it will capture keypresses and touch gestures to move the map.


2 Answers

Did you extend the main class as MapActivity?

public class a extends MapActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}
like image 42
Lope Emano Avatar answered Sep 30 '22 12:09

Lope Emano


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!

like image 194
Bobs Avatar answered Sep 30 '22 12:09

Bobs