android - Google Play 服务 + Android Studio 模拟器

标签 android google-maps autocomplete google-play-services

我最近在使用 Android Studio 模拟器时遇到了这个问题,我不明白它是如何出现的以及为什么会出现,因为直到现在我的模拟器和应用程序都运行良好。

现在,当我尝试运行我的应用程序(使用 Google map 和 Google Places 自动完成)时,一条消息显示未安装 Google Play 服务。我设法将它安装在我的模拟器上,但该应用程序仍然无法正常运行。 Google map 出现,但 Google Places 自动完成功能不再起作用。

我注意到这是 Android 开发人员中的一个常见问题,经过一些研究后,我一直在尝试调整一些解决方案,但问题仍然存在。

谁能帮我解决这个问题并向我解释为什么会这样?是因为一些 Android Studio 更新了吗?

(错误信息)

    05-20 21:56:52.528: A/GmsApplication(2108): Unable to install secure provider, due to exception:

    05-20 21:56:52.528: A/GmsApplication(2108): java.lang.SecurityException: attempting to read gservices without permission: Neither user 10053 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.app.ContextImpl.enforce(ContextImpl.java:1914)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1943)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:600)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gsf.f.c(SourceFile:107)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gsf.f.a(SourceFile:121)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gsf.f.a(SourceFile:227)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gms.common.a.l.a(SourceFile:301)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gms.common.a.e.a(SourceFile:219)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gms.common.a.d.c(SourceFile:197)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gms.common.a.d.d(SourceFile:208)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gms.common.security.ProviderInstallerImpl.insertProviderGated(SourceFile:90)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.google.android.gms.common.app.GmsApplication.onCreate(SourceFile:84)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4556)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.app.ActivityThread.access$1500(ActivityThread.java:151)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.os.Handler.dispatchMessage(Handler.java:102)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.os.Looper.loop(Looper.java:135)

    05-20 21:56:52.528: A/GmsApplication(2108):     at android.app.ActivityThread.main(ActivityThread.java:5257)

    05-20 21:56:52.528: A/GmsApplication(2108):     at java.lang.reflect.Method.invoke(Native Method)

    05-20 21:56:52.528: A/GmsApplication(2108):     at java.lang.reflect.Method.invoke(Method.java:372)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)

    05-20 21:56:52.528: A/GmsApplication(2108):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)


    05-20 21:56:52.552: D/AndroidRuntime(2108): Shutting down VM


    05-20 21:56:52.560: E/AndroidRuntime(2108): FATAL EXCEPTION: main

    05-20 21:56:52.560: E/AndroidRuntime(2108): Process: com.google.android.gms, PID: 2108

    05-20 21:56:52.560: E/AndroidRuntime(2108): java.lang.RuntimeException: Unable to start receiver com.google.android.gms.subscribedfeeds.ConfigurationReceiver: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10053 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2619)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.app.ActivityThread.access$1700(ActivityThread.java:151)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.os.Handler.dispatchMessage(Handler.java:102)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.os.Looper.loop(Looper.java:135)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.app.ActivityThread.main(ActivityThread.java:5257)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at java.lang.reflect.Method.invoke(Native Method)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at java.lang.reflect.Method.invoke(Method.java:372)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

    05-20 21:56:52.560: E/AndroidRuntime(2108): Caused by: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10053 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.app.ContextImpl.enforce(ContextImpl.java:1914)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1943)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:600)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at com.google.android.gsf.f.c(SourceFile:107)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at com.google.android.gsf.f.a(SourceFile:121)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at com.google.android.gsf.f.a(SourceFile:182)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at com.google.android.gms.subscribedfeeds.ConfigurationReceiver.onReceive(SourceFile:31)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2612)

    05-20 21:56:52.560: E/AndroidRuntime(2108):     ... 9 more

最佳答案

您必须在具有 Google API 的模拟器上运行该应用程序,这是您创建模拟器时的一个选项。只需使用 Google API 选择目标,请参见下图:

AVD Screenshot

关于android - Google Play 服务 + Android Studio 模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30360476/

相关文章:

javascript - 使用自动完成 jquery 和 Odoo rpc 调用输入不显示建议

android - Ant 不使用 `ant debug install` 重建 Android 应用程序

android - Gradle 同步失败 : Read Timed Out

javascript - Google Places 自动完成 - 在 Enter 键上选择第一个结果?

javascript - 使用 JQuery map 更新中心和缩放

javascript - Jquery UI 自动完成 JSON 文件的结果

android - 在android应用程序中使用静态类变量是否安全

安卓 Stripe 集成

Android Google Maps API API23 上的安全异常

bash - 如何在不影响其他完成脚本的情况下重置 COMP_WORDBREAKS?