簡體   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