-
Notifications
You must be signed in to change notification settings - Fork 704
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
getDirectoryPath() doesn't work in example app on Android 11 (OnePlus) #745
Comments
There are a number of similar issues reported which the author suspects is due to 'special directories' but that's not the case. I found that getPath() is used in FileUtils.java, which in Android 11 is blocked and getDirectory() is suggested instead. See this link: @miguelpruivo can you try changing getPath to getDirectory? Hope this works! |
@algoexpt just tried it without success. Although I can confirm that using SDK 30 prevents me immediately from selecting invalid folders like shown in the screenshot. |
Can confirm this does not work on Android 11 (just returns "/"). Hope it gets fixed. |
getDirectory works for all media directories, except Downloads root and storage roots are not allowed. I tried granting the app with ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION but it still didn't allow selecting storage roots |
Same here. |
@tomm1e does that work for previous versions? |
Hello, any update on this? I'm also facing this issue.
Device - Android 11 Emulator |
I just checked the pull request changes on android 10 and found that it didn't work. It did work completely in android 11, even for folders inside downloads. |
@brightseagit and does the current version work on Android 10 for you? If so, I may add a version check to make it backwards compatible before merging. |
Hello, So, yes the old version works fine on android 10. And it would be great if you could add the version check to make it backwards compatible. Thank you. |
@brightseagit Test #763 again I added the fallback. |
I just checked and found that it is working on android 10 and 11. But in android 10 I noticed that it gives |
@brightseagit this little nuances and differences across multiple SDK make it really tough to create a reliable API for this. 😞 Anyway, I think that this might be the best we have as of now. |
@miguelpruivo yes I 💯% agree with that 👍. |
Just deployed a new version (3.0.4) with a fix for this. Thank you @tomm1e for the effort. |
If you update this library to 3.0.4 and your Android targetSdkVersion and compileSdkVersion points to 29, compilation will fail. |
Describe the bug
flutter run --release
on Android 11 (OnePlus in my case)-> Always returns an empty path (
/
) even for unprotected directoriesWhen changing the
targetSdkVersion
to29
inexample/android/app/build.gradle
, the bug disappearsPlatform
Platform OS version
Android 11 (OnePlus)
How are you picking?
FilePicker.platform.getDirectoryPath()
in the example appDetails to reproduce the issue
flutter run --release
Flutter Version details
The text was updated successfully, but these errors were encountered: