DevsOnFlutter / file_manager

FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.
https://pub.dev/packages/file_manager
BSD 3-Clause "New" or "Revised" License
61 stars 18 forks source link

File Access Permission Not working on Android #25

Open mohamedaminehnioua opened 1 year ago

mohamedaminehnioua commented 1 year ago

Requesting file permission is not working on Android too.

AndroidManifest.xml

   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

log: Unhandled Exception: MissingPluginException(No implementation found for method requestFilesAccessPermission on channel myapp/channel).

ablause commented 1 year ago

Does anyone have a solution to this problem?

steffomix commented 1 year ago

Use permission handler as workaround. You most likely will need it anyway. https://pub.dev/packages/permission_handler

import 'package:permission_handler/permission_handler.dart';

await Permission.manageExternalStorage.isGranted; await Permission.manageExternalStorage.request();

mohamedaminehnioua commented 1 year ago

Use permission handler as workaround. You most likely will need it anyway. https://pub.dev/packages/permission_handler

import 'package:permission_handler/permission_handler.dart';

await Permission.manageExternalStorage.isGranted; await Permission.manageExternalStorage.request();

It's true, but they should make it work like that the package will be independent and not require any other packages .

Mustafa-Mohammad-kurdi commented 1 year ago

I/flutter (27441): FileSystemException: Directory listing failed, path = '/storage/emulated/0/' (OS Error: Permission denied, errno = 13) E/flutter (27441): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method requestFilesAccessPermission on channel myapp/channel) E/flutter (27441): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:175:7) E/flutter (27441): E/flutter (27441): #1 FileManager.requestFilesAccessPermission (package:file_manager/file_manager.dart:116:9) E/flutter (27441): E/flutter (27441): #2 HomePage.build. (package:bredar/main.dart:95:12) E/flutter (27441): E/flutter (27441):

joshua750 commented 1 year ago

same issue i facing

laowangDemon commented 1 year ago

set targetSdkVersion 29 if targetSdkVersion>=30 AndroidMainfest.xml add android:preserveLegacyExternalStorage="true"