我一直在关注谷歌地图的教程,这是一个非常基本的教程http://umut.tekguc.info/en/content/google-android-map-v2-step-step,我无法在模拟器上运行应用程序,iv下载并安装了vend.apk和gms.apk文件同时也从SDK管理器下载了谷歌播放服务。完成所有这些操作后,当我最终在模拟器上运行我的应用程序时,会发生以下错误: “安装错误: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级别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
感谢您的所有时间。我非常感谢各种帮助。
答案 0 :(得分:1)
确保您创建并使用带有“Google API”目标的AVD。
否则将无法找到Google地图。
如果您未在目标列表中获得该选项,请确保已从SDK Manager下载该选项。