0

i have requested permissions and allow permission request on oreo android and i tried to create folder in the root of internalstorage using getExternalStorageDirectory() and Directory.create(). but folder is not created (no file access) while this code works finely on other android versions below sdk 27.

my flutter doctor:

[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
X Android license status unknown.
[√] Android Studio (version 3.2)
[√] VS Code (version 1.29.1)
[√] VS Code, 64-bit edition (version 1.26.1)
[√] Connected device (1 available)

! Doctor found issues in 1 category.

please help me find solution.Thanks in advance

ankuranurag2
  • 2,300
  • 15
  • 30
PrakashKing
  • 635
  • 2
  • 11
  • 24
  • 1
    Are you certain you're explicitly requesting `WRITE_EXTERNAL_STORAGE`? Have a look [my answer here](https://stackoverflow.com/a/47788508). – Mike M. Nov 21 '18 at 18:07
  • yeas i have asked permisions on flutter. have a look at [link](https://pub.dartlang.org/packages/permission) – PrakashKing Nov 22 '18 at 05:51
  • I'm not sure what you mean. Are you saying that you're requesting all of those permissions shown in the link? – Mike M. Nov 22 '18 at 05:53
  • i have requested permission of storage which includes both read and write permissions in it. but not able to create file only in oreo? thanks in advance – PrakashKing Nov 22 '18 at 06:16
  • Anyhoo, I found the problem. Whoever wrote that plugin needs to update it. The issue is exactly as I explain in my answer that I linked above. They're only requesting one permission in a given group. Prior to Oreo, this would've automatically granted all of the other permissions in that group, as well. However, that was a bug, and was fixed. When you request the Storage group, it's only requesting `READ_EXTERNAL_STORAGE`, so you aren't getting `WRITE_EXTERNAL_STORAGE` anymore. https://github.com/once10301/permission/blob/master/android/src/main/java/com/ly/permission/PermissionPlugin.java#L97 – Mike M. Nov 22 '18 at 06:34
  • I'm not really sure why they decided to request `READ_EXTERNAL_STORAGE`. The `WRITE_EXTERNAL_STORAGE` implicitly includes reading, so it would've made more sense to request the write permission in the first place. They do the same for each permission group, too, as you can see in the link above. This means that they're all broken. Somebody should create an issue there, if one hasn't been already. – Mike M. Nov 22 '18 at 06:38
  • 1
    i posted about issues in github for this problem. – PrakashKing Nov 22 '18 at 12:13

0 Answers0