【问题标题】:Blank screen google maps on UI test xamarin androidUI测试xamarin android上的黑屏谷歌地图
【发布时间】:2018-12-06 10:36:02
【问题描述】:

我为 Xamarin Forms 项目编写 Ui 测试,在 iOS 上使用谷歌地图它们工作正常,但在 android 上只显示空白屏幕。 如果构建在调试/发布或安装 apk 地图工作,但如果我使用 UI 测试什么。我使用 Nunit 2.6.4 并在本地设备和模拟器和 AppCenter 上进行测试。

【问题讨论】:

  • 这可能是密钥库问题,您在 UITest 中启动应用程序时是否发送了密钥库信息?我之前已经看到这会导致 Google 地图出现问题。
  • 不行,我该怎么办?
  • 是的,谢谢这么匹配,这对我有帮助,现在谷歌地图在本地模拟器上工作,但在 AppCenter 上没有任何改变。我使用谷歌像素设备集,而不是像“../../../appname.apk”这样的绝对路径和配置密钥库。 Mb AppCenter不支持android上的google play api?
  • 是的,当您将密钥库发送到 App Center 时,您还必须将其与 appcenter-cli 一起发送 :) 让我写一个正确的答案!

标签: xamarin.android google-maps-android-api-2 xamarin.uitest visual-studio-app-center


【解决方案1】:

为什么会出现这个问题

当您编译包含 Google 地图的 .apk 时,地图会使用您的密钥库设置来验证地图是否合法(我不记得手头的确切细节,但基本上 - 如果密钥库信息用于签署.apk 更改 - 它破坏了地图)。

默认情况下,当您使用 UITest 而不发送密钥库信息时 - UITest 会使用自己的密钥库执行各种神奇的操作。这会导致地图停止工作。

如何在本地解决这个问题

要在本地修复测试运行,您需要告诉 UITest 使用您最初用于构建 .apk 文件的密钥库:

public AndroidAppConfigurator KeyStore (String path, String storePassword, String keyPassword, String keyAlias)

是您在设置应用配置时要使用的方法:

ConfigureApp
   .Android
   .ApkFile("path/to/my.apk")
   .Keystore(path, password, alias)
   .StartApp(mode);

如何在应用中心解决此问题

如果您想将测试发送到 App Center,那么您还需要做一件事 - 即在使用以下参数调用 appcenter-cli 时包含密钥库信息(您可以从 @ 987654324@:

   --key-password <arg>                 Password to the matching private  
                                        key in the keystore. Corresponds  
                                        to the "-keypass" argument in     
                                        jarsigner                         
   --key-alias <arg>                    Alias to the key in the keystore. 
                                        Corresponds to the "-alias"       
                                        argument in jarsigner             
   --store-password <arg>               Password to the keystore.         
                                        Corresponds to the "-storepass"   
                                        argument in jarsigner             
   --store-path <arg>                   Path to the keystore file

附:如果您在使用 App Center 时遇到问题 - 我建议您使用网站底部角落的 Intercom 小部件打开对话 - 这会将您转至应该能够为您提供帮助的测试支持团队(您甚至可能会得到跟我说话!:))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多