facebook / screenshot-tests-for-android

Generate fast deterministic screenshots during Android instrumentation tests
http://facebook.github.io/screenshot-tests-for-android
Apache License 2.0
1.74k stars 229 forks source link

sdcard not accessible #256

Closed dscheucher closed 4 years ago

dscheucher commented 4 years ago

Hey, i stumbled across a potential issue, Environment.getExternalStorageDirectory() does return my /storage/emuated/0 directory, while the getSdcardDir in ScreenshitDirectories.java returns /sdcard which doesn't seem to exist. Besides that it would be cool if it was possible to specify the screenshot directory path.

dscheucher commented 4 years ago

java.lang.RuntimeException: Failed to create the directory /sdcard/screenshots/xxxx.test/screenshots-default for screenshots. Is your sdcard directory read-only? at com.facebook.testing.screenshot.internal.ScreenshotDirectories.getSdcardDir(ScreenshotDirectories.java:126)

dscheucher commented 4 years ago

android:requestLegacyExternalStorage="true" fixed the problem

oradkovsky commented 3 years ago

@dscheucher for Android 11, the above fix will not work