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

时间:2017-10-16 20:33:48

标签: 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>

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

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

有谁知道如何解决它?

2 个答案:

答案 0 :(得分:1)

这是Android Studio添加的字段。请参阅文档developer.android.com/guide/topics/manifest/..."当您单击Run"时,Android Studio会自动添加此属性。不使用Android Studio,我从命令行构建了一个APK,然后我可以将其上传到Firebase测试实验室进行测试。

答案 1 :(得分:0)

当您使用即时运行选项时,以这种方式生成的APK不能用于任何类型的firebase测试。

而是选择上面的构建选项,然后选择构建APK选项,以这种方式生成的APK可用于firebase测试。