android - 除非您更新 Google Play 服务错误,否则此应用将无法运行

标签 android google-maps android-emulator google-play google-play-services

我现在有点迷路了。 我正在使用 Google map 实现一个 Android 应用程序。

为了使它工作,我遵循了一些非常有效的教程。但是我坚持这个“:

enter image description here

为了解决这个问题,我发现了一些技巧 herehere这告诉你要解决这个问题,你必须对模拟器进行特殊配置,这是我的:

enter image description here

并在模拟器上安装一些 .apk。

enter image description here

魔术应该完成, map 应该出现,这不是我的情况。

我检查了我的附加功能是否安装良好:

enter image description here

这是我的 AndroidManifest:

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

    <uses-sdk android:minSdkVersion="16"/>

    <permission android:name="mypack.permission.MAPS_RECEIVE"
                android:protectionLevel="signature"/>
    <uses-permission android:name="mypack.permission.MAPS_receive"/>

    <!-- Permission pour utiliser la connexion internet -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Permission permettant de vérifier l'état de la connexion -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- Permission pour stocker des données en cache de la map -->
    <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" />

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

    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="MYKEY" />

        <meta-data android:name="com.google.android.gms.version"
                   android:value="@integer/google_play_services_version" />

        <activity android:name="Home"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>

</manifest>

这是我的 MainActivity

import android.app.Activity;
import android.os.Bundle;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;

public class Home extends Activity {
    /**
     * Called when the activity is first created.
     */
    private GoogleMap map;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    }
}

以及对应的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
        >
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/map"
              android:name="com.google.android.gms.maps.MapFragment"
              android:layout_width="match_parent"
              android:layout_height="match_parent" />
</LinearLayout>

希望找到一些修复或我在这里错过的东西,提前谢谢你。

最佳答案

在 Android SDK Manager 中,您必须在“Android 4.4.2 (API 19)”下安装“Google APIs (x86 System Image)”。退出 Eclipse 并重新启动它。

然后在 AVD 管理器中创建一个新的 android 虚拟设备并选择“Google APIs x86 (Google Inc.) - API Level 19”作为目标。勾选“Use Host GPU”,保证 map 绘制会加速。

就是这样,这个新的模拟器将预装 Play Services,并且运行速度更快,因为它是 x86 镜像。

关于android - 除非您更新 Google Play 服务错误,否则此应用将无法运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23450007/

相关文章:

javascript - 使用 StageWebView.loadString() 在 AIR for iOS 上显示 Google map

Android 在使用 MapView 的 ViewGroup.removeAllViews() 上卡住

java - Android 语音转文本可以在模拟器中使用,但不能在手机上使用

android - 文本到语音应用程序无法在 android studio 的模拟器中运行,但可以在 android 设备中运行

java - 我的 android 应用程序在模拟器中崩溃

android - 启用库时 MultiDex 应用程序 : java. lang.ClassNotFoundException

android - smoothScrollToPosition() 仅在 Android ICS 中滚动到一半?

安卓 Youtube API : how to play video when YoutubeView is invisible

安卓 fragment : is empty constructor really required?

javascript - 理解异步 JavaScript(谷歌地图)