在GCloud中使用Firebase截屏时出错 [英] Getting error while taking screenshots with Firebase in GCloud

查看:85
本文介绍了在GCloud中使用Firebase截屏时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从此处,进入我非常简单的Android项目.我非常仔细地遵循了教程中概述的步骤.

I am facing a lot of trouble trying to integrate screenshotter library from here, into my very simple Android project. I followed the steps outlined in the tutorial pretty meticulously.

当我查看来自gcloud的日志时,看到以下错误

When I look at logs from gcloud I see the following error

01-07 19:41:06.724:E/cloud_screenshotter(5752):发生异常 屏幕截图:java.io.FileNotFoundException: /sdcard/screenshots/com.computemachines.android.workplay.ClockingActivityScreenshotTest-takeScreenshot-main_screen_3-1.jpg: 打开失败:ENOENT(没有这样的文件或目录)

01-07 19:41:06.724: E/cloud_screenshotter(5752): Exception taking screenshot: java.io.FileNotFoundException: /sdcard/screenshots/com.computemachines.android.workplay.ClockingActivityScreenshotTest-takeScreenshot-main_screen_3-1.jpg: open failed: ENOENT (No such file or directory)

有趣的是,我在同一台计算机上有一个不同的项目,其构建结构几乎完全相同,在其中截取工作的屏幕截图! gradle版本,测试用例,build.gradle文件在两者中完全相同.

Funnily enough, I have a different project in the same computer with almost identical build structure in which taking screenshots work! The gradle version, test case, build.gradle files are exactly the same in both.

摘录自 app/build.gradle 在无效的存储库中

An excerpt from app/build.gradle in the repo that doesn't work

androidTestCompile (name:'cloudtestingscreenshotter_lib', ext:'aar')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    // Espresso testing
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support:support-annotations:25.1.0', {
        exclude group: 'com.google.code', module: 'jsr305'
}

无效的整个存储库位于 GitHub ,有效的存储库位于此处.

The whole repo that doesn't work is at GitHub and the repo that works is here.

用于调用内部版本并在GCloud上运行的调用命令是相同的

The invocation command for invoking the builds and running on GCloud is the same for both

./gradlew clean assembleDebug assembleDebugAndroidTest && gcloud beta test android run \
  --type instrumentation \
  --app app/build/outputs/apk/app-debug-unaligned.apk \
  --test app/build/outputs/apk/*est-unaligned.apk \
  --device-ids Nexus6 \
  --os-version-ids 23 \
  --locales en \
  --orientations portrait

我花了十多个小时来尝试解决这个问题,而我尝试过的所有事情的简要思维导图是此处.我可以提供需要解决但希望解决此问题的任何其他信息.

I have spent more than 10 hours on trying to figure this out and a summary mind map of all things I tried is here. I can provide any other information that is needed but wanted to solve this problem.

推荐答案

为了将屏幕截图写到预期位置,应用必须拥有WRITE_EXTERNAL_STORAGE权限,

In order to write the screenshot to the expected location, the app must hold the WRITE_EXTERNAL_STORAGE permission, as described in the documentation.

这篇关于在GCloud中使用Firebase截屏时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆