https://kotlinlang.org logo
#android
Title
# android
c

Can

01/17/2020, 9:29 AM
Good Morning! I am trying to migrate my UI-Tests for Android 10 but my scripts fails, since i can’t grant
WRITE_EXTERNAL_STORAGE
on an Android 10 devices - any known workarounds?
google 1
w

wasyl

01/17/2020, 9:44 AM
Afaik you can set legacy behavior in manifest for tests
android:requestLegacyExternalStorage="true"
c

Can

01/17/2020, 9:48 AM
Oh - that’s awesome. Thanks! I really did not think of this.
Although this is something they told us will be removed with Android 11 oder Android 12. I would love to have a statement from the Google guys if there is (or will be) an idiomatic way for this.
w

wasyl

01/17/2020, 10:57 AM
Shouldn’t you migrate to SAF for the app, in which case you won’t need these permissions? I’m not working with storage recently so I’m not up to date with all the implications here
c

Can

01/17/2020, 1:32 PM
Yeah you are right, but the
BasicScreenCaptureProcessor
does not seem to support SAF as of now
w

wasyl

01/17/2020, 1:44 PM
I’d suggest opening an issue and hoping Google will fix it before they deprecate legacy mode 😉
c

Can

01/17/2020, 2:07 PM
Yeah, i think that might be the correct approach
c

Chris Craik

01/19/2020, 2:56 AM
There's a feature in Android Gradle plugin in 4.0 to have gradle copy data off device before uninstall (can manually opt in for 3.6 https://developer.android.com/studio/profile/benchmark#android_gradle_plugin_36_and_higher)
That's the intended replacement - can read the instrumenation arg additionalTestOutputDir from device, and it gets copied to host. If not running through Gradle though (maybe in ci) you'll need to do that copy before uninstalling the test app
c

Can

01/20/2020, 10:32 AM
Thanks a lot!
But this looks like a TestRunner Feature of Benchmark, right?
c

Chris Craik

01/20/2020, 4:06 PM
No, it's a feature of the Android Gradle plugin - the benchmark infra is just what's using it first
7 Views