无法从 Firebase gcloud 命令行启动仪器测试
Failed to start an instrument test from Firebase gcloud command line
我尝试使用 Firebase 测试实验室测试应用,但收到一条错误消息 "testOnly APKs are not allowed."
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 Test Lab Device Matrix" 时,firebase 测试有效。
我在我的项目中搜索 "testOnly" 但没有找到。看起来是 gradle 将属性注入了 AndroidManifest.xml.
有人知道怎么解决吗?
这是 Android Studio 添加的字段。参考文档developer.android.com/guide/topics/manifest/…"Android Studio automatically adds this attribute when you click Run"。不使用 Android Studio,我从命令行构建了一个 APK,然后我可以将它上传到 Firebase 测试实验室进行测试。
我也遇到了同样的问题。我最终通过使用 'Build > Build APK(s)'
生成 apk 来解决
APk 生成于:app\build\outputs\apk\debug
apk 是用 'testOnly' 标签生成的,它在 firebase 上运行。
我在 https://developer.android.com/studio/run/index.html
上找到了这个信息
当您使用即时 运行 选项时,以这种方式生成的 APK 不能用于任何类型的 firebase 测试。
而是 select 上面的构建选项,然后 select 构建 APK 选项和以这种方式生成的 APK 可用于 firebase 测试。
我尝试使用 Firebase 测试实验室测试应用,但收到一条错误消息 "testOnly APKs are not allowed."
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 Test Lab Device Matrix" 时,firebase 测试有效。
我在我的项目中搜索 "testOnly" 但没有找到。看起来是 gradle 将属性注入了 AndroidManifest.xml.
有人知道怎么解决吗?
这是 Android Studio 添加的字段。参考文档developer.android.com/guide/topics/manifest/…"Android Studio automatically adds this attribute when you click Run"。不使用 Android Studio,我从命令行构建了一个 APK,然后我可以将它上传到 Firebase 测试实验室进行测试。
我也遇到了同样的问题。我最终通过使用 'Build > Build APK(s)'
生成 apk 来解决APk 生成于:app\build\outputs\apk\debug
apk 是用 'testOnly' 标签生成的,它在 firebase 上运行。 我在 https://developer.android.com/studio/run/index.html
上找到了这个信息当您使用即时 运行 选项时,以这种方式生成的 APK 不能用于任何类型的 firebase 测试。
而是 select 上面的构建选项,然后 select 构建 APK 选项和以这种方式生成的 APK 可用于 firebase 测试。