android - 使用 Google Maps API v2 时,Android 2.2 模拟器上缺少 Google Play 服务

标签 android google-play-services google-maps-api-2 android-maps

嘿,我正在尝试在我的模拟器上使用 Google map ,即使我在运行它说的应用程序时安装了 Google Play 服务库

This app won't run without Google Play Services which are missing from your phone

在 LogCat 上,我收到了有关它的警告,但不确定为什么会收到此警告。

我的 MainActivity.java

package com.mapsmaps;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        GoogleMap mapa = ((SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map)).getMap();

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <fragment
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment" />

</RelativeLayout>

AndroidManifest.xml

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

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

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

    <uses-permission android:name="com.mapsmaps.permission.MAPS_RECEIVE" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />F

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" 
        >
        <activity
            android:name="com.mapsmaps.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>

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyBdbj4iXi0SijKjJDrJw5RigtSpQcaID7Q" />
    </application>

</manifest>

LogCat-

D/dalvikvm(451): DexOpt: couldn't find field 
    Landroid/content/res/Configuration;.smallestScreenWidthDp
W/dalvikvm(451): VFY: unable to resolve instance field 24
D/dalvikvm(451): VFY: replacing opcode 0x52 at 0x0012
D/dalvikvm(451): VFY: dead code 0x0014-0018 in 
    Lcom/google/android/gms/common/GooglePlayServicesUtil;.b 
    (Landroid/content/res/Resources;)Z
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.

library screenshot

emulator screenshot

最佳答案

“要在使用 Google Play 服务 SDK 时测试您的应用,您必须使用带有运行基于 Android 4.2.2 或更高版本的 Google API 平台的 AVD 的 Android 模拟器。”

来自 http://developer.android.com/google/play-services/setup.html

关于android - 使用 Google Maps API v2 时,Android 2.2 模拟器上缺少 Google Play 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14622231/

相关文章:

android - 物理地址、设备地址和虚拟地址的区别

android - 在 Android Studio 3.0 中构建 PIE 和非 PIE 可执行文件

Android 项目 : Export problem Launch canceled! Proguard 返回错误代码 1。请参阅控制台

java - Places SDK 中的 APIException 9011 和 9010 错误

Android RadioGroup 按钮重力

android - 将 Google Play 服务添加到 gradle (Android Studio) 不起作用

android - 如何在满足特定条件时结束android订阅?

android - 更新 google play 服务(8.1 至 8.3)后应用程序无法安装

node.js - 为什么在 console.developers.google.com 中创建 API key 时收到此错误消息 :'This API project was not found'

android - 如何在 Google Maps Api v2 Android 中禁用缩小手势?