gpt4 book ai didi

带有 Google Play : Google Play services is missing 的 Android Studio

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:25:51 25 4
gpt4 key购买 nike

我使用的是 Ubuntu 14、Android Studio 0.8.6。我正在使用 Genymotion 运行应用程序,我得到的响应是:

W/GooglePlayServicesUtil﹕ Google Play services is missing.

尝试了Import Google Play Services library in Android Studio的解决方案, 也来自 Android Studio with Google Play Services .从 Android SDK 管理器安装了以下软件包:Android 支持存储库、Android 支持库、Google Play 服务、Google 存储库。

我正在尝试运行 Android Studio 默认 Activity ( map Activity )。这是 list 文件:

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps" >
<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.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key" />
</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

来自 build.gradle 的依赖:

dependencies {
compile 'com.google.android.gms:play-services:5.2.08'
compile 'com.android.support:appcompat-v7:20.0.0'
}

默认的 MapsActivity.java:

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MapsActivity extends FragmentActivity {

private GoogleMap mMap; // Might be null if Google Play services APK is not available.

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
setUpMapIfNeeded();
}

@Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}

private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
setUpMap();
}
}
}

private void setUpMap() {
mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
}
}

我错过了什么,可能是什么问题?非常感谢任何帮助。

谢谢。

最佳答案

找到了解决方案。必须做两件事 - 将 Play 服务版本设置为较低版本:5.0.89。最新版本无法从我测试的任何(虚拟)设备下载,需要更新。

其次,要将 Google Play 服务安装到 Genymotion VM,请按照此链接下的说明进行操作:How to install Google Play Services in a Genymotion VM (with no drag and drop support)? .

干杯。

关于带有 Google Play : Google Play services is missing 的 Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25703145/

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