除非您更新Google Play服务,否则AndroidStudio模拟器“将无法运行”

时间:2015-09-30 02:47:24

标签: java android android-studio google-play-services

我的模拟器出现此问题,我使用的是API 5.1.1,我从SDK Manager获得了最新版本的Google Play服务。

的AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

在build.grable中:

compile 'com.google.android.gms:play-services:+'

11 个答案:

答案 0 :(得分:23)

导航至设置 - &gt;您的模拟器中的应用,然后找到Google Play服务,检查版本号并在build.gradle

中使用它

希望这有帮助

答案 1 :(得分:3)

将模拟器中的SDK更改为v21或更低版本。物理设备不受此问题的影响。

Android抱怨Google Play服务更新的原因与API v22及更高版本的Android模拟器中的已知问题有关(此时为23)。 https://code.google.com/p/android/issues/detail?id=176348

您应该尝试在构建脚本中使用最新版本的Play服务,因为用户通常不得不在其设备上使用最新版本的。

答案 2 :(得分:2)

我将SDK从5.1降级到5.0并且它正常工作。

答案 3 :(得分:2)

当我在模拟器Android 5.1.1(x86_64) - API 22上启动我的应用程序时出现此问题。我已阅读有关它的一些讨论,但没有人帮助我。

我尝试在gradle构建脚本中调整Google Play服务的版本(我的意思是您应该使用&#34; app&#34; name)更新脚本。在脚本中更新内容时,不要忘记同步gradle。

我的gradle脚本&#34; app&#34;更新后:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        applicationId "com.itmm.map"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.google.android.gms:play-services:9.0.0'
    testCompile 'junit:junit:4.12'
}

请查看依赖项部分。你对下面的脚本行感兴趣:

compile 'com.google.android.gms:play-services:9.0.0'

目前,版本。 9.0.0帮助我,一切都很好。我可以在Android模拟器上看到MapActivity。 9.0.0不是Google Play服务的最新版本(最新版本是9.6.1),但它可以解决您的问题,如果您不相关ver的新功能。 9.6.1。

答案 4 :(得分:1)

你的build.gradle有这一行:

compile 'com.google.android.gms:play-services:+'

这意味着Android会在应用运行时使用最新版本的Google Play服务。模拟器可能没有所有最新更新,因此应用程序将无法运行。更新Google Play服务会有所帮助。

答案 5 :(得分:1)

在Android Studio 2.2上遇到同样的问题。我做的是去SDK Manger - &gt; Launch Standalone SDK Manager,已卸载Broken Intel x86 Atom google_apis。重新启动Android Studio并运行项目,弹出窗口询问Download System Image,点击OK继续,然后问题就消失了。

答案 6 :(得分:1)

在模拟器上使用Google帐户登录后,我的问题已得到解决。 “更新”按钮在此之后起作用

答案 7 :(得分:1)

I had the same issue. But I followed the following things
1) First download the latest build tools and play services in Android SDK 
Android Studio -> Tools -> Android -> SDK Manager -> SDK Tools -> Android SDK Build Tools -> Install them 
& install Play Services by following same steps 

2) Create a new emaulator with latest api level for ex( API level : 28)

3) Run the app in the latest emulator 

It will work fine.

答案 8 :(得分:0)

如果您安装了Google Play服务,请检查您的SDK设置: Android Studio - 系统设置 - Android SDK - SDK工具:

寻找: Google Play服务 Google Play许可库,并确保其状态为: 已安装 .....如果上面的清单是完美的,你应该执行的下一步是:

打开 build.gradle 项目级别gradle 并检查您的gradle是否有:

classpath 'com.google.gms:google-services:3.1.0'

然后在应用程序级别gradle 中: 在依赖关系下:

       dependencies{
     implementation 'com.google.android.gms:play-services-auth:11.8.0'
 and at the end of your gradle file:

    repositories {
    mavenCentral()
    apply plugin: 'com.google.gms.google-services'
}

下一步

点击模拟器通知栏中的通知错误,然后使用您的Google帐户登录(现有电子邮件地址和密码) 然后尝试再次运行应用程序...如果您仍然收到错误,请单击通知错误并尝试登录,,,继续尝试,直到最终谷歌Playstore应用程序将安装并提示您更新它。 这是最简单的过程,它需要一点点耐心,但它总是有效。 祝你好运

答案 9 :(得分:0)

我的模拟器的Google Play服务版本为12.6.85

所以我将build.gradle更改为:        implementation 'com.google.android.gms:play-services-maps:12.0.1'

注意:

答案 10 :(得分:0)

自2020年以来我还没有看到任何可行的解决方案。有两种解决方法:

  1. 简便的方法是使用PlayStore Enabled创建一个新的模拟器。下载模拟器的系统映像之前,请进行检查。

  2. 硬方法是在仿真器上手动安装Google Play Store并使更新按钮起作用。您可以参考安装部分here

此后,该应用将在几分钟内自动更新Google Play服务。就是这样。

注意:如果这样不起作用,请转到Chrome->搜索Google Play服务,然后打开该应用的playStore链接并在那里进行更新。