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.
When I look at logs from gcloud I see the following error
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)
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.
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'
}
The whole repo that doesn't work is at GitHub and the repo that works is here.
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.