Google 在新笔记本电脑上升级到 Android Studio 2.1.2 后地图无法使用

Google Map not working since upgrade to Android Studio 2.1.2 on new laptop

我最近将我的项目从一台笔记本电脑转移到另一台。 我安装了最新版本的 Android Studio,即 2.1.2 我的旧笔记本电脑是 运行ning 版本 1.5.1

gradle.build 导入新笔记本电脑的新版本后,我的 MapsActivity 不再工作,而之前它工作得很好。 因此,我知道问题不在代码中,也不在 google.

中的 API 键中

我想我已经从 SDK 管理器下载了所有相同的包。

最初是 "rebuilt",提示有一个片段 "issue",我通过下载 Google Play 服务解决了这个问题,但现在它什么也没有显示。

非常欢迎任何帮助或建议。 当我在AVD模拟器中运行应用程序时出现以下信息。

06-09 18:43:17.909 2971-2971/com.example.grant.fbcc I/art: Not late-enabling -Xcheck:jni (already on)
06-09 18:43:18.016 2971-2971/com.example.grant.fbcc W/System: ClassLoader referenced unknown path: /data/app/com.example.grant.fbcc-1/lib/x86
06-09 18:43:28.469 2971-2971/com.example.grant.fbcc W/System: ClassLoader referenced unknown path: /data/app/com.example.grant.fbcc-1/lib/x86
06-09 18:43:28.597 2971-2971/com.example.grant.fbcc W/art: Verification of void com.google.android.gms.measurement.internal.zzw.<init>(com.google.android.gms.measurement.internal.zzaa) took 101.927ms
06-09 18:43:28.679 2971-2971/com.example.grant.fbcc I/GMPM: App measurement is starting up, version: 8487
06-09 18:43:28.679 2971-2971/com.example.grant.fbcc I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
06-09 18:43:28.717 2971-2971/com.example.grant.fbcc E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services.  Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
06-09 18:43:28.717 2971-2971/com.example.grant.fbcc E/GMPM: Scheduler not set. Not logging error/warn.
06-09 18:43:28.782 2971-3094/com.example.grant.fbcc E/GMPM: Uploading is not possible. App measurement disabled
06-09 18:43:29.031 2971-2971/com.example.grant.fbcc W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
06-09 18:43:29.162 2971-3105/com.example.grant.fbcc D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true

                                                                  [ 06-09 18:43:29.168  2971: 2971 D/         ]
                                                                  HostConnection::get() New Host Connection established 0xa15a2330, tid 2971


                                                                  [ 06-09 18:43:29.211  2971: 3105 D/         ]
                                                                  HostConnection::get() New Host Connection established 0xa15a20f0, tid 3105
06-09 18:43:29.219 2971-3105/com.example.grant.fbcc I/OpenGLRenderer: Initialized EGL, version 1.4
06-09 18:43:39.145 2971-3094/com.example.grant.fbcc I/GMPM: Tag Manager is not found and thus will not be used
06-09 18:45:48.613 2971-2977/com.example.grant.fbcc W/art: Suspending all threads took: 9.378ms

您是否在 Developer Console 中更新了您的凭据? 如果您在新笔记本电脑上构建,它有一个不同的调试密钥,它不能与您现有的 API 密钥一起使用。

转到 Developer Console > Credentials,使用更新后的 SHA-1 创建一个新的 Android 密钥,您应该会恢复正常。 (DevCon 网站有关于如何在需要时从您的新笔记本电脑上获取 SHA-1 的说明)

In addition to the above answer, which was definitely required for the original problem, I would like to add the following requirement that I found was required in my re-build: -

In the following link, are a number of compile statements, https://developers.google.com/android/guides/setup

Of which I needed to add the following line to the app build gradle

compile 'com.google.android.gms:play-services-maps:9.2.0'