0

我一直在关注关于谷歌地图的教程,这里有一个非常基本的教程http://umut.tekguc.info/en/content/google-android-map-v2-step-step,我无法在模拟器上运行应用程序, iv 下载并安装了 vend.apk 和 gms.apk 文件,还从 SDK 管理器下载了 google play 服务。在完成所有这些之后,当我最终在模拟器上运行我的应用程序时,出现以下错误:“安装错误:INSTALL_FAILED_MISSING_SHARED_LIBRARY”。

我也尝试过更改 AVD,但它不起作用。我认为我无法使用 AVD 正确配置 API。任何帮助将不胜感激,谢谢大家。这是我的代码:MainActivity.java:

package com.example.googlemapsandroidv2;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

  public class MainActivity extends Activity {

private GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mMap=((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
    final LatLng CIU=new LatLng(35.21843892856462, 33.41662287712097);
    Marker ciu=mMap.addMarker(new MarkerOptions().position(CIU).title("My Office"));
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

 } 

这是清单:

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.example.googlemapsandroidv2"
      android:versionCode="1"
      android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="17" />

 <permission
    android:name="com.example.googlemapsandroidv2.permission.MAPS_RECEIVE"
    android:protectionLevel="signature"></permission>


 <uses-permission
    android:name="com.example.googlemapsandroidv2.permission.MAPS_RECEIVE"/>
<uses-permission
    android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission
    android:name="android.permission.INTERNET"/>
<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission
    android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission
    android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>


<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
         <meta-data  
         android:name="com.google.android.maps.v2.API_KEY"
         android:value="AIzaSyCLhVm6faqwv8gaj1aWZ_Xvlsf4sMal42U"/>
         <uses-library
    android:name="com.google.android.maps" />
    <activity
        android:name="com.example.googlemapsandroidv2.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

   </manifest>

以下是有关 AVD 的详细信息:Targert:Android 4.0(API level 14) CPU/ABI:ARM(armeabi-v7a)

这就是我在控制台上得到的:

[2013-07-18 14:27:31 - GoogleMapsAndroidV2] Android Launch!
[2013-07-18 14:27:31 - GoogleMapsAndroidV2] adb is running normally.
[2013-07-18 14:27:31 - GoogleMapsAndroidV2] Performing com.example.googlemapsandroidv2.MainActivity activity launch
[2013-07-18 14:27:31 - GoogleMapsAndroidV2] Automatic Target Mode: launching new emulator with compatible AVD 'MapTestAvd'
[2013-07-18 14:27:31 - GoogleMapsAndroidV2] Launching a new emulator with Virtual Device 'MapTestAvd'
[2013-07-18 14:27:33 - GoogleMapsAndroidV2] New emulator found: emulator-5554
[2013-07-18 14:27:33 - GoogleMapsAndroidV2] Waiting for HOME ('android.process.acore') to be launched...
[2013-07-18 14:28:29 - GoogleMapsAndroidV2] HOME is up on device 'emulator-5554'
[2013-07-18 14:28:29 - GoogleMapsAndroidV2] Uploading GoogleMapsAndroidV2.apk onto device 'emulator-5554'
[2013-07-18 14:28:40 - GoogleMapsAndroidV2] Installing GoogleMapsAndroidV2.apk...
[2013-07-18 14:29:26 - GoogleMapsAndroidV2] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2013-07-18 14:29:26 - GoogleMapsAndroidV2] Please check logcat output for more details.
[2013-07-18 14:29:26 - GoogleMapsAndroidV2] Launch canceled!
[2013-07-18 14:34:40 - SDK Manager] Warning: Ignoring add-on 'addon-google_apis-google-14': File not found: manifest.ini
[2013-07-18 14:37:09 - SDK Manager] Warning: Ignoring add-on 'addon-google_apis-google-14': File not found: manifest.ini
[2013-07-18 14:54:40 - SDK Manager] Warning: Ignoring add-on 'addon-google_apis-google-14': File not found: manifest.ini

谢谢大家的时间。我真的很感激各种帮助。

4

1 回答 1

1

确保创建并使用带有“Google API”目标的 AVD。

否则它将找不到谷歌地图。

在此处输入图像描述

如果您的目标列表中没有该选项,请确保您已从 SDK 管理器下载它。

在此处输入图像描述

于 2013-07-18T10:02:56.147 回答