Android Studio不会在应用中显示地图

时间:2015-01-29 16:03:27

标签: android facebook google-maps android-studio google-play-services

您好我有一个显示地图的应用。一切都很好,但我想使用模拟器调试它,但在模拟器上我得到了这个错误。

“您设备上未安装Google Play服务!”

好的,我在挖掘,我发现它必须对SDK做一些事情,所以我确保安装和更新“Extras”下的所有必要服务。但仍然没有变化我一直收到此错误,并且模拟器上没有显示地图。好的,然后我挖了一些,人们说我必须修复我的gradel文件(我也使用facebook SDK)所以这就是我做的:

为应用程序提供gradle:

dependencies {
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.github.nirhart:parallaxscroll:1.0'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/chart.jar')
compile project(':facebook')
/*Adding app Compat to compatibilize Lollipop widgets*/
compile 'com.android.support:appcompat-v7:21.0.+'
/*Card view (the cute one on lollipop)*/
compile 'com.android.support:cardview-v7:21.0.+'
/*recycler view, la posta de la optimizacion*/
compile 'com.android.support:recyclerview-v7:21.0.+'
compile('com.crashlytics.sdk.android:crashlytics:2.2.0@aar') {
    transitive = true;
}
compile('com.twitter.sdk.android:twitter:1.1.1@aar') {
    transitive = true;
}
compile 'com.android.support:support-v13:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}

这是facebook SDK的gradle文件:

dependencies {
compile 'com.android.support:support-v4:20.0.+'
compile 'com.parse.bolts:bolts-android:1.1.2'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'com.google.maps:google-maps-services:0.1.5'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:support-v13:21.0.3'
}

这是我在logcat中收到的错误消息:

01-29 17:56:15.860    2375-2375/com.myapp.user W/GooglePlayServicesUtil﹕ Google Play services is missing.
01-29 17:56:15.880    2375-2375/com.myapp.user W/GooglePlayServicesUtil﹕ Google Play services is missing.
01-29 17:56:15.880    2375-2375/com.myapp.user W/GooglePlayServicesUtil﹕ Google Play services is missing.
01-29 17:56:15.890    2375-2375/com.myapp.user W/GooglePlayServicesUtil﹕ Google Play services is missing.
01-29 17:56:15.940    2375-2410/com.myapp.user W/EGL_emulation﹕ eglSurfaceAttrib not implemented
01-29 17:56:15.940    2375-2410/com.myapp.user W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f4811e9a840, error=EGL_SUCCESS

1 个答案:

答案 0 :(得分:2)

从Android Studio创建新的虚拟设备,当向导要求您选择系统映像时,请确保在目标列上选择了一个说明Google API(Google Inc)的图像。

然后,当您启动应用程序时,请确保选择刚刚创建的模拟器图像。

Google Play服务和Google地图仅适用于经Google认可的设备,默认情况下不适用于普通模拟器图片。