繁体   English   中英

使用Google Maps Api V2时,Android 2.2或4.1.2模拟器上的Google Play服务缺失

[英]Google Play Services Missing on Android 2.2 or 4.1.2 Emulator while using Google Maps Api V2

嘿,即使我在运行应用程序时安装了Google Play服务库,我仍在尝试在模拟器上使用Google Maps

“如果没有您的手机缺少的Google Play服务,此应用将无法运行”

在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>

logcat的

01-31 11:10:41.404: D/dalvikvm(451): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp

01-31 11:10:41.404:W / dalvikvm(451):VFY:无法解析实例字段24 01-31 11:10:41.404:D / dalvikvm(451):VFY:在0x0012 01-31处替换操作码0x52 11:10:41.404:D / dalvikvm(451):VFY:Lcom / google / android / gms / common / GooglePlayServicesUtil; .b(Landroid / content / res / Resources;)中的无效代码0x0014-0018 Z 01-31 11 :10:41.443:W / GooglePlayServicesUtil(451):缺少Google Play服务。 01-31 11:10:41.454:W / GooglePlayServicesUtil(451):缺少Google Play服务。 01-31 11:10:41.464:W / GooglePlayServicesUtil(451):缺少Google Play服务。 01-31 11:10:41.464:W / GooglePlayServicesUtil(451):缺少Google Play服务。 01-31 11:10:41.475:W / GooglePlayServicesUtil(451):缺少Google Play服务。 01-31 11:10:41.494:W / GooglePlayServicesUtil(451):缺少Google Play服务。 01-31 11:10:41.504:W / GooglePlayServicesUtil(451):缺少Google Play服务。

如果您想使用您的应用测试您的Google Play服务实现,则您的模拟器应支持Google API。

您可以轻松地做到这一点,方法是创建一个新的模拟器虚拟设备,然后将所需的Google API级别图像添加为目标,例如:Google API-API级别18

如果您想使用您的应用测试您的Google Play服务实现,则您的模拟器应支持Google API。

您可以轻松地做到这一点,方法是创建一个新的模拟器虚拟设备,然后将所需的Google API级别图像添加为目标,例如: Google API-API级别18

也请参考此问题以获取更多信息: Google API Level 18模拟器“除非您更新Google Play服务,否则此应用程序将无法运行”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM