I’m trying to make an Android maps app. As I’m new to all this I’m fiddling around with the basics so I decided to create a map, show a button and digital clock.
When I run the project the emulator loads however when it tries to load the app it force closes.
My main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<DigitalClock android:text="@+id/DigitalClock01"
android:id="@+id/DigitalClock01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></DigitalClock>
<Button android:text="@+id/Button01"
android:layout_width="wrap_content"
android:id="@+id/Button01"
android:layout_height="wrap_content"></Button>
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="xyz_my_key" />
</LinearLayout>
In my manifest I have added the uses-library definition
<uses-library android:name="com.google.android.maps"/>
and I have also added the internet usage permission
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
Why is it crashing?
last entry from error log:
No command output when running: ‘am
start -n
com.example.android.google.apis/com.example.android.google.apis.com.example.android.apis.MapsDemo
-a android.intent.action.MAIN -c android.intent.category.LAUNCHER’ on
device emulator-5554
i didn’t setup the project properly. i’ve gone back restarted copied and pasted the source and hey presto it works