Android Studio与Google Play:Google Play服务缺失
我使用的是Ubuntu 14,Android Studio 0.8.6。我正在使用Genymotion运行应用程序,得到的响应是:Android Studio与Google Play:Google Play服务缺失,android,android-studio,google-play,google-maps-android-api-2,genymotion,Android,Android Studio,Google Play,Google Maps Android Api 2,Genymotion,我使用的是Ubuntu 14,Android Studio 0.8.6。我正在使用Genymotion运行应用程序,得到的响应是: W/GooglePlayServicesUtil﹕ Google Play services is missing. 试过的解决方案,也从。从Android SDK管理器安装了以下软件包:Android支持库、Android支持库、Google Play服务、Google存储库 我正在尝试运行Android Studio默认活动(映射活动)。以下是清单文件: &l
W/GooglePlayServicesUtil﹕ Google Play services is missing.
试过的解决方案,也从。从Android SDK管理器安装了以下软件包:Android支持库、Android支持库、Google Play服务、Google存储库
我正在尝试运行Android Studio默认活动(映射活动)。以下是清单文件:
<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" />
默认的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 Services版本设置为更低:5.0.89。最后一个版本无法从我测试的任何(虚拟)设备下载,需要更新 其次,要将Google Play服务安装到Genymotion VM,请遵循以下链接下的说明:
干杯。另一个解决方案是将模拟器的目标更改为Google API 要在使用Google Play services SDK时测试应用程序,您必须使用Android emulator和AVD,该AVD运行基于Android 4.2.2或更高版本的Google API平台。
Ojonugwa的解决方案很好,但另外,最新版本的Google Play服务在模拟器上不可用也存在问题。但是,在运行API版本21或19的模拟器上可以使用适当版本的Google Play Services 目前的解决方案是创建一个API版本为21或19的新AVD,并以Google API(而不是Andriod x.x.x)为目标。 如果使用API版本为21或19的Google API AVD,它应该可以正常工作
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"));
}
}