• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Using Map API - crashes on launch

Hi,

I am using the Android Map API for the first time to embed a map in my application. I have done a lot of searching and most tutorials line up, and I have followed everything as far as I can tell very accurately, but still when my activity with the map launches, it crashes instantly.

My class with the map is not my main class, it launches when a button is pressed. Initially the app is fine, and when I hit the button that starts my activity with the map, it crashes. Lets call that activity, "MoreInfo".

So, my "More Info" extends com.google.android.maps.MapActivity, and imports that same thing as well. I also import com.google.android.maps.MapView, and android.os.Bundle. What is strange to me is that com.google.android.maps.MapActivity and MapView are yellow underlined, saying they are not used. This is technically true because I have nothing interacting with them programatically as of yet.

The MoreInfo.xml fine for the GUI, has this LinearLayout embedded into a RelativeLayout

Code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id = "@+id/show_on_map"
                android:orientation="vertical"
                android:layout_width="310dip"
                android:layout_height="240dip"
                android:layout_below = "@+id/location_box"
            >
                <com.google.android.maps.MapView 
                    android:id="@+id/mapview1"
                    android:layout_width="fill_parent" 
                    android:layout_height="fill_parent" 
                    android:enabled="true" 
                    android:clickable="true" 
                    android:apiKey="0QgcCar5Krn4WHy3D3XIIOtCXu8UkYTFR3XYNug" 
                /> 
            </LinearLayout>

My Android Manifest has these uses-permissions above the <application> tag:

Code:
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

And again in the manifest I have

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

inside of the <application> tag.

I got my API key correctly, I think my XML is ok, I imported everything correctly, I have the API checked in the project properties, and my Manifest looks good...

Why does my app's MoreInfo crash on launch?
 
Back
Top Bottom