在使用Google地图API v2时,Google Play服务在Android 2.2模拟器上缺失 [英] Google Play Services missing on Android 2.2 emulator while using Google Maps API v2

查看:231
本文介绍了在使用Google地图API v2时,Google Play服务在Android 2.2模拟器上缺失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


嘿,我试图在模拟器上使用Google地图,即使我安装了Google Play服务库

如果没有Google Play服务,此应用将无法运行,而您的手机中缺少这些应用。


LogCat我收到关于它的警告但不知道为什么我得到这个。



我的MainActivity.java

  package com.mapsmaps; 

导入android.os.Bundle;
导入android.support.v4.app.FragmentActivity;
导入android.view.Menu;

导入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();


$ b @Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater()。inflate(R.menu.activity_main,menu);
返回true;


code $ <$ $ p

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.0encoding =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/>

<使用权限android:name =com.mapsmaps.permission.MAPS_RECEIVE/>

android:glEsVersion =0x00020000
android:required =true/> F

<使用-permission android:name =android.permission.INTERNET/>
< uses-permission android:name =android.permission.WRITE_EXTERNAL_STORAGE/>
<使用权限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>

< 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:找不到字段
Landroid / content / res / Configuration; .smallestScreenWidthDp
W / dalvikvm(451):VFY:无法解析实例字段24
D / dalvikvm(451):VFY:替换操作码0x52在0x0012
D / dalvikvm(451):VFY:死码0x0014-0018 in
Lcom / google / android / gms /common/GooglePlayServicesUtil;.b
(Landroid / content / res / Resources;)Z
W / GooglePlayServicesUtil(451):Google Play服务丢失。
W / GooglePlayServicesUtil(451):Google Play服务丢失。
W / GooglePlayServicesUtil(451):Google Play服务丢失。
W / GooglePlayServicesUtil(451):Google Play服务丢失。
W / GooglePlayServicesUtil(451):Google Play服务丢失。
W / GooglePlayServicesUtil(451):Google Play服务丢失。
W / GooglePlayServicesUtil(451):Google Play服务丢失。



解决方案

要在使用Google Play服务SDK时测试您的应用程序,您必须使用以下任一项:



运行Android 2.3或更高版本且兼容Google Play商店的兼容Android设备。
Android模拟器,带有运行基于Android 4.2.2或更高版本的Google API平台的AVD。


Hey I am trying to use Google Maps on my emulator even though I've installed Google Play Services library when I run the app it says

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

on LogCat I get the warning about it but not really sure why I am getting this.

my 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.

解决方案

To test your app when using the Google Play services SDK, you must use either:

A compatible Android device that runs Android 2.3 or higher and includes Google Play Store. The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.

这篇关于在使用Google地图API v2时,Google Play服务在Android 2.2模拟器上缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆