android - 无法从 Firebase gcloud 命令行启动仪器测试

标签 android firebase firebase-test-lab

我尝试使用 Firebase 测试实验室测试应用,但收到错误消息“不允许使用 testOnly APK”。

C:\temp>gcloud firebase test android run     --type instrumentation  --app myapp.apk      --test myapp-androidTest.apk    --device model=Nexus10,version=22,locale=en,orientation=landscape       --timeout 300s

Have questions, feedback, or issues? Get support by visiting:
  https://firebase.google.com/support/

Uploading [myapp.apk] to Firebase Test Lab...
Uploading [myapp-androidTest.apk] to Firebase Test Lab...
Raw results will be stored in your GCS bucket at [https://console.developers.google.com/storage/browser/test-lab-j9zwyqscmy0rw-k53tazzivjxvu/2017-10-16_11:56:43.691000_AcnJ/]

Test [matrix-1vxb29yr0b2z7] has been created in the Google Cloud.
Firebase Test Lab will execute your instrumentation test on 1 device(s).
Creating individual test executions...failed.
ERROR: (gcloud.firebase.test.android.run)
Matrix [matrix-1vxb29yr0b2z7] failed during validation: "testOnly" found in the Manifest. testOnly APKs are not allowed.

C:\temp>

但是,当我通过将部署目标选项设置为“Firebase 测试实验室设备矩阵”在 Android Studio 3.0 RC1 中运行 Firebase 测试时,该测试可以正常工作。

我在我的项目中搜索了“testOnly”但没有找到它。看起来是 gradle 将属性注入(inject)到 AndroidManifest.xml 中。

有谁知道怎么解决吗?

最佳答案

我也有同样的问题。我最终通过使用“Build > Build APK(s)”生成 apk 来解决

APk 生成于:app\build\outputs\apk\debug

该 apk 是在没有“testOnly”标签的情况下生成的,并且在 firebase 上运行。 我在 https://developer.android.com/studio/run/index.html 上找到了此信息

关于android - 无法从 Firebase gcloud 命令行启动仪器测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46778658/

相关文章:

android - 如何使复选框在 android 中看起来更好

android - OnClick 监听器应用于整个卡片 View ,而不仅仅是 textView

Android - Windows Live API,用户每次都必须登录?

android - 加载屏幕直到 map 出现

javascript - admin.auth().setCustomUserClaims "is not a function"

使用 firebase 的 iOS 订阅 server_to_server 通知

android - 如何为 firebase teSTLab 添加 testInstrumentation 环境变量?

Android - "firebase.test.lab"设置无法从 Firebase 分析中排除 Play 商店测试 Activity

android-espresso - 动态功能模块上的 UI Espresso 测试

javascript - 我怎样才能正确地消除 firebase 云功能的执行