views:

465

answers:

1

I want to learn some programming for my android phone. I was successful doing the hello world app. Now I wanted to try the mapview found here: http://developer.android.com/resources/tutorials/views/hello-mapview.html

My code is the following:

package com.example.hellomapview;

import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.ZoomControls;
import com.google.android.maps.*;


public class HelloMapView extends MapActivity {
    /** Called when the activity is first created. */
 LinearLayout linearLayout;
 MapView mapView;
 ZoomControls mZoom;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        linearLayout = (LinearLayout) findViewById(R.id.zoomview);
        mapView = (MapView) findViewById(R.id.mapview);
        mZoom = (ZoomControls) mapView.getZoomControls();
        linearLayout.addView(mZoom);
        setContentView(R.layout.main);
    }
    protected boolean isRouteDisplayed() {    return false;}
}

I'm using eclipse and I have the SDK and AVD all installed correctly but as soon as I do a run->run in eclipse it starts off ok with:

[2010-01-15 12:27:03 - HelloMapView]New emulator found: emulator-5554 [2010-01-15 12:27:03 - HelloMapView]Waiting for HOME ('android.process.acore') to be launched... [2010-01-15 12:27:46 - HelloMapView]HOME is up on device 'emulator-5554' [2010-01-15 12:27:46 - HelloMapView]Uploading HelloMapView.apk onto device 'emulator-5554' [2010-01-15 12:27:46 - HelloMapView]Installing HelloMapView.apk...

The emulator comes up and I see my droid phone ready to load the HelloMapView app..but then it dies with the following:

[2010-01-15 12:27:51 - HelloMapView]Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY [2010-01-15 12:27:51 - HelloMapView]Please check logcat output for more details. [2010-01-15 12:27:52 - HelloMapView]Launch canceled!

I've never done any android type development and I come from a C# background so my java is iffy...but does anyone see anything that I might be missing?

+2  A: 

My guess is that you've created an emulator that doesn't include the Google APIs.

If you launch tools/android you'll see in available packages that there's e.g. "SDK Platform Android 1.5, API 3" and "Google APIs by Google Inc. Android API 3".

You need to install the Google APIs package, and use that one when creating a virtual device if you want to use maps.

Mirko Nasato
well now I I have the google APIS android api 3 rev 3 installed already. The new error I am getting when I do a run->run is "HelloMapView] Could not find HelloMapView.apk".
JonH