运行时谷歌地图查看错误 - Droid

时间:2010-01-15 17:33:59

标签: java android eclipse google-maps

我想为我的Android手机学习一些编程。 我成功地做了你好世界的应用程序。 现在我想尝试在这里找到的mapview:http://developer.android.com/resources/tutorials/views/hello-mapview.html

我的代码如下:

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;}
}

我正在使用eclipse并且我已经正确安装了SDK和AVD但是只要我在eclipse中运行>运行它就开始了:

[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!

我从未做过任何Android类型的开发,而且我来自C#背景,所以我的java是iffy ......但有没有人看到我可能会丢失的任何东西?

1 个答案:

答案 0 :(得分:3)

我的猜测是你创建了一个不包含Google API的模拟器。

如果您启动tools/android,您会在可用的套餐中看到例如“SDK平台Android 1.5,API 3”和“Google API by Google Inc. Android API 3”。

如果您想使用地图,则需要安装Google API包,并在创建虚拟设备时使用该包。