Java AndroidStudio 模拟器“除非您更新 Google Play 服务,否则不会运行”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32856919/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
AndroidStudio emulator "won't run unless you update Google Play Services"
提问by Raphael Teyssandier
I have this problem with my emulator, i'm using API 5.1.1 and i have the lastest version of Google Play Services from SDK Manager.
我的模拟器有这个问题,我使用的是 API 5.1.1 并且我有来自 SDK Manager 的最新版本的 Google Play 服务。
AndroidManifest.xml:
AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
In the build.grable:
在 build.grable 中:
compile 'com.google.android.gms:play-services:+'
采纳答案by Raphael Teyssandier
I downgrade the SDK to 5.0 from 5.1 and it's work.
我将 SDK 从 5.1 降级到 5.0,它的工作。
回答by LonelyIdiot
Your build.gradle has this line:
你的 build.gradle 有这一行:
compile 'com.google.android.gms:play-services:+'
This means that android will use the latest version of Google Play Services when ever the app is run. The emulator might not have all the latest updates so the app will not run. Updating Google Play Services will help.
这意味着无论何时运行该应用程序,android 都将使用最新版本的 Google Play 服务。模拟器可能没有所有最新更新,因此应用程序将无法运行。更新 Google Play 服务会有所帮助。
回答by vab
Navigate to settings--> apps in your emulator and then find Google Play Services, check the version number and use it in you build.gradle
导航到设置--> 模拟器中的应用程序,然后找到 Google Play 服务,检查版本号并在 build.gradle 中使用它
Hope this helps
希望这可以帮助
回答by Will Vanderhoef
Change the SDK in your emulator to v21 or lower. Physical devices are not effected by this issue.
将模拟器中的 SDK 更改为 v21 或更低版本。物理设备不受此问题的影响。
The reason Android is complaining about an update for Google Play services is related to a known issue in Android emulators for API v22 and up (at this time 23). https://code.google.com/p/android/issues/detail?id=176348
Android 抱怨 Google Play 服务更新的原因与 API v22 及更高版本(此时为 23)的 Android 模拟器中的已知问题有关。 https://code.google.com/p/android/issues/detail?id=176348
You should try to use the latest version of Play Services in your build script as users are generally forced to have the latest version of this on their device.
您应该尝试在构建脚本中使用最新版本的 Play 服务,因为用户通常被迫在他们的设备上安装最新版本的 Play 服务。
回答by Dino Tw
Encountered the same problem on Android Studio 2.2. What I did was to go to SDK Manger
-> Launch Standalone SDK Manager
, uninstalled Broken Intel x86 Atom google_apis
. Restarted Android Studio and ran the project, a popup asked Download System Image
, hit OK
to continue, the problem then went away.
在 Android Studio 2.2 上遇到同样的问题。我所做的是去SDK Manger
-> Launch Standalone SDK Manager
,卸载Broken Intel x86 Atom google_apis
. 重新启动Android Studio并运行项目,弹出一个询问Download System Image
,点击OK
继续,问题就消失了。
回答by Dmitry
This problem occurred when I start my application on emulator Android 5.1.1 (x86_64) - API 22. I have read some discussions about it, but no one from them helped me.
当我在模拟器 Android 5.1.1 (x86_64) - API 22 上启动我的应用程序时发生了这个问题。我已经阅读了一些关于它的讨论,但没有人帮助我。
I tried to adjust version of Google Play Services in gradle build script (I mean you should update the script with "app" name). Don't forget to sync gradle when you update something in your script.
我试图在 gradle 构建脚本中调整 Google Play 服务的版本(我的意思是你应该用“app”名称更新脚本)。当您更新脚本中的某些内容时,请不要忘记同步 gradle。
My gradle script "app" after updates:
更新后我的 gradle 脚本“app”:
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'
}
Please, have a look into dependencies section. You're interesting in the follwoing line of script:
请查看依赖项部分。您对以下脚本行很感兴趣:
compile 'com.google.android.gms:play-services:9.0.0'
Currently, ver. 9.0.0 helps me and everything is ok. I can see MapActivity on Android emulator. 9.0.0 is not a newest version of Google Play Services (the newest is 9.6.1), but it works and it can solve your problem, if you aren't interestion in new features of ver. 9.6.1.
目前,版本。9.0.0 对我有帮助,一切正常。我可以在 Android 模拟器上看到 MapActivity。9.0.0 不是 Google Play 服务的最新版本(最新版本是 9.6.1),但如果您对 ver 的新功能不感兴趣,它可以工作并且可以解决您的问题。9.6.1.
回答by Boy
My issue was resolved after logging in with an google account on the emulator. The 'update' button worked after that
在模拟器上使用谷歌帐户登录后,我的问题得到解决。“更新”按钮在那之后起作用了
回答by RileyManda
Check in your SDK settings if youve installed google play services: Android Studio--System Settings--Android SDK--SDK Tools:
如果您安装了 google play 服务,请检查您的 SDK 设置: Android Studio--系统设置--Android SDK--SDK 工具:
Look for:Google Play Servicesand Google Play Licensing Libraryand make sure that both their status is:Installed.....if the above checklist is perfect,the next step you ought to perform is:
寻找:Google Play Services和Google Play Licensing Library并确保它们的状态都是:Installed.....如果上面的清单是完美的,你应该执行的下一步是:
Open your build.gradleproject level gradleand check that your gradle has:
打开您的build.gradle项目级别的 gradle并检查您的 gradle 是否具有:
classpath 'com.google.gms:google-services:3.1.0'
Then in your App level gradle: Under dependencies:
然后在您的App 级别 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'
}
Next
下一个
Click on the notification error you keep getting in your notification bar of your emulator and sign in with your google account(existing Email Address and password) Then try and run the app again...if you still get the error,click the notification error and try to sign in,,,keep trying until eventually the google playstore app will install and prompt you to update it. This is the simplest process,it requires a little bit of patience but evetually it works. Good Luck
单击您在模拟器的通知栏中不断收到的通知错误,然后使用您的 google 帐户(现有电子邮件地址和密码)登录,然后再次尝试运行该应用程序...如果仍然出现错误,请单击通知错误并尝试登录,继续尝试,直到最终 google Playstore 应用程序将安装并提示您更新它。这是最简单的过程,需要一点耐心,但最终还是有效的。 祝你好运
回答by Jaya
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.
回答by Dan Alboteanu
my emulator's Google Play services version is 12.6.85
我的模拟器的 Google Play 服务版本是 12.6.85
so I changed the build.gradle like:
implementation 'com.google.android.gms:play-services-maps:12.0.1'
所以我改变了 build.gradle 像:
implementation 'com.google.android.gms:play-services-maps:12.0.1'
Notes:
笔记:
- to check emulator's Google Play services version: go to Emulator \ Settings \ Apps \ GooglePlay services
- to see available versions for the build.gradle check https://developers.google.com/android/guides/releases
- 检查模拟器的 Google Play 服务版本:转到 Emulator \ Settings \ Apps \ GooglePlay services
- 查看 build.gradle 检查的可用版本https://developers.google.com/android/guides/releases