1. Download our Official Android App: Forums for Android!

Apps Using Map API - crashes on launch

Discussion in 'Android Development' started by UNEXPECTED62, Apr 3, 2010.


    UNEXPECTED62 Lurker
    Thread Starter
    Jan 31, 2010

    Jan 31, 2010

    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 (Text):
    1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    2.                 android:id = "@+id/show_on_map"
    3.                 android:orientation="vertical"
    4.                 android:layout_width="310dip"
    5.                 android:layout_height="240dip"
    6.                 android:layout_below = "@+id/location_box"
    7.             >
    8.                 <com.google.android.maps.MapView
    9.                     android:id="@+id/mapview1"
    10.                     android:layout_width="fill_parent"
    11.                     android:layout_height="fill_parent"
    12.                     android:enabled="true"
    13.                     android:clickable="true"
    14.                     android:apiKey="0QgcCar5Krn4WHy3D3XIIOtCXu8UkYTFR3XYNug"
    15.                 />
    16.             </LinearLayout>
    My Android Manifest has these uses-permissions above the <application> tag:

    Code (Text):
    1.  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    2.     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    3.     <uses-permission android:name="android.permission.INTERNET" />
    And again in the manifest I have

    Code (Text):
    1. <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?


Share This Page