如何为我的 Google 地图应用程序使用具有 Google Play 服务依赖项的非 Nexus 5 模拟器
How to use non-Nexus 5 emulators with Google Play Services dependency for my Google Maps app
我的测试方法涉及使用许多不同配置的模拟器 (makes/models/dimensions/apis/targets)。
我最近升级到 Android Studio 3.1。
我的应用程序已经运行了 3 年并使用 Google Maps v2,我想继续维护它(Google 笑)。
我现在拥有的每个模拟器(Nexus 5 除外)都无法使用,因为它说 Google Play 服务需要更新,而且似乎没有解决它的方法。 Nexus 5 模拟器没有错误,但显示空白地图背景。
当我尝试删除对 Google Play 服务的任何依赖时,它最终会变得很滑(主要是替换融合位置服务)。
问题:如果我的 Google Maps v2 应用程序依赖 Google Play 服务(也许是我的第一个错误?),我是否仅限于Nexus 5 模拟器(似乎有其自身的问题)?如果没有,那么如何升级其他优秀的模拟器(Pixel、其他 Nexus、Galaxy...)?
我看到其他问题,我会继续关注它们,但我想了解什么是未来维护的可行途径 - 删除依赖项,升级某些内容...
供参考:
非 Nexus 5 相关错误是:
(app) won't run unless you update Google Play services
(A big fat
'Update' button is also displayed which throws an exception -
presumably because it is not installed on the emulator.)
Nexus 5 相关错误是:
E/Google Maps Android API: Google Maps Android API v2 only supports
devices with OpenGL ES 2.0 and above
(Which I can't enable in the AVD manager for Nexus 5 emulators.)
这是一些典型的 gradle 疯狂 - 我试图将播放服务降低到 11.8.0 并且这个不幸的魔法发生了(来自 gradlew app:depencencies):
+--- com.google.android.gms:play-services-maps:11.8.0 -> 12.0.1 | +--- com.google.android.gms:play-services-base:12.0.1 | | +--- com.google.android.gms:play-services-basement:12.0.1 | | |
+--- com.android.support:support-v4:26.1.0 () | | | --- com.google.android.gms:play-services-basement-license:12.0.1 | |
+--- com.google.android.gms:play-services-tasks:12.0.1 | | | +--- com.google.android.gms:play-services-basement:12.0.1 () | | | --- com.google.android.gms:play-services-tasks-license:12.0.1 |
| --- com.google.android.gms:play-services-base-license:12.0.1 |
+--- com.google.android.gms:play-services-basement:12.0.1 (*) | --- com.google.android.gms:play-services-maps-license:12.0.1
庆典
@xiaomi 正确地将问题归因于 play-services(或特别是 play-services-maps)12.0.1 所以在一些 gradle 战斗之后我将所有 play-* 降到 11.8.0 和非-Nexus 模拟器工作。
经验教训:
- 切勿盲目遵循 gradle 警告建议升级版本!
- "gradlew app:dependencies"是你的朋友。
结语
三思而后行:
我们可以使用的最新 Google Play 服务与最新模拟器可以处理的服务之间经常存在延迟。
当模拟器上的应用程序要求更新时,一个解决方案是使用较低版本的 Google Play 服务。
如果地图显示为空白,通常是 key registration
的问题
我的测试方法涉及使用许多不同配置的模拟器 (makes/models/dimensions/apis/targets)。
我最近升级到 Android Studio 3.1。
我的应用程序已经运行了 3 年并使用 Google Maps v2,我想继续维护它(Google 笑)。
我现在拥有的每个模拟器(Nexus 5 除外)都无法使用,因为它说 Google Play 服务需要更新,而且似乎没有解决它的方法。 Nexus 5 模拟器没有错误,但显示空白地图背景。
当我尝试删除对 Google Play 服务的任何依赖时,它最终会变得很滑(主要是替换融合位置服务)。
问题:如果我的 Google Maps v2 应用程序依赖 Google Play 服务(也许是我的第一个错误?),我是否仅限于Nexus 5 模拟器(似乎有其自身的问题)?如果没有,那么如何升级其他优秀的模拟器(Pixel、其他 Nexus、Galaxy...)?
我看到其他问题,我会继续关注它们,但我想了解什么是未来维护的可行途径 - 删除依赖项,升级某些内容...
供参考:
非 Nexus 5 相关错误是:
(app) won't run unless you update Google Play services
(A big fat 'Update' button is also displayed which throws an exception - presumably because it is not installed on the emulator.)
Nexus 5 相关错误是:
E/Google Maps Android API: Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above
(Which I can't enable in the AVD manager for Nexus 5 emulators.)
这是一些典型的 gradle 疯狂 - 我试图将播放服务降低到 11.8.0 并且这个不幸的魔法发生了(来自 gradlew app:depencencies):
+--- com.google.android.gms:play-services-maps:11.8.0 -> 12.0.1 | +--- com.google.android.gms:play-services-base:12.0.1 | | +--- com.google.android.gms:play-services-basement:12.0.1 | | |
+--- com.android.support:support-v4:26.1.0 () | | | --- com.google.android.gms:play-services-basement-license:12.0.1 | |
+--- com.google.android.gms:play-services-tasks:12.0.1 | | | +--- com.google.android.gms:play-services-basement:12.0.1 () | | | --- com.google.android.gms:play-services-tasks-license:12.0.1 | | --- com.google.android.gms:play-services-base-license:12.0.1 |
+--- com.google.android.gms:play-services-basement:12.0.1 (*) | --- com.google.android.gms:play-services-maps-license:12.0.1
庆典
@xiaomi 正确地将问题归因于 play-services(或特别是 play-services-maps)12.0.1 所以在一些 gradle 战斗之后我将所有 play-* 降到 11.8.0 和非-Nexus 模拟器工作。
经验教训:
- 切勿盲目遵循 gradle 警告建议升级版本!
- "gradlew app:dependencies"是你的朋友。
结语
三思而后行:
我们可以使用的最新 Google Play 服务与最新模拟器可以处理的服务之间经常存在延迟。
当模拟器上的应用程序要求更新时,一个解决方案是使用较低版本的 Google Play 服务。
如果地图显示为空白,通常是 key registration
的问题