gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:50:40 28 4
gpt4 key购买 nike

嘿,我正在尝试在我的模拟器上使用 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com