-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WRITE_EXTERNAL_STORAGE Permission on newer devices #39
Comments
Are you running from the command line or Android Studio? |
Android Studio, from the test class. |
Hmm that may be why. Does it work if you run from the command line with |
|
Well that's gonna depend on why it's failing, but that's out of the scope of this issue, it seems. |
It seems to respect the adbOptions for me, as long as you have the permission defined in the AndroidManifest |
@athkalia I still see the same issue. Were you able to get the test running from Android Studio? |
@felipecsl I too noticed the error: We need WRITE_EXTERNAL_STORAGE permission for OkReplay. |
I'll give it another bash over the weekend and update here |
indeed I've tried it once more and it doesn't seem to work, sorry |
Setup is here btw if you want to experiment a bit |
I've been running usually on API25 emulators with no problems. Are you running on physical devices? |
Confirmed that I ran into the same problem trying to run a test against the LG v20 from A.S. |
I was able to get past the permission problem by using the GrantPermissionRule.
|
I'm unable to get past the permissions issue with the @Rule
@JvmField
public val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE) |
@scottyab did you put that in a companion object? |
Thanks @malachid 👍 I'd forgotten the need for companion object. The below allows me to run Espresso tests from Android Studio. companion object {
@ClassRule
@JvmField
val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE)
} |
After going in circles for the better part of a day, I've found that I need the following tools value in order for the GrantPermissionRule to work (in addition to the
|
After going in circles despite above suggestions, using ClassRule in companion object worked, but this gave me a hint that it's an rules ordering issue so also this approach below works using just RuleChain and regular
|
When trying to run the sample tests on my Nexus 6P running Android 7.1.2 I get the following RuntimeException:
This option is already in the
build.gradle
file of the sample.The text was updated successfully, but these errors were encountered: