【发布时间】:2021-04-08 23:09:51
【问题描述】:
我已经设置了允许外部存储文档并可能列出所有 PDF 文档的权限。尽管将这些行添加到您的 AndroidManifest.xml 文件中,但在启动小部件时仍会出现错误消息。
请告知如何修复此错误消息。
Exception has occurred.
FileManagerError (
Try to add thes lines to your AndroidManifest.xml file
`<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>`
`<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>`
and grant storage permissions to your applicaion from app settings
FileSystemException: Directory listing failed, path = '/storage/emulated/0/' (OS Error: Permission denied, errno = 13))
这是错误的来源:
void getFiles() async { //asyn function to get list of files
List<StorageInfo> storageInfo = await PathProviderEx.getStorageInfo();
var root = storageInfo[0].rootDir; //storageInfo[1] for SD card, geting the root directory
var fm = FileManager(root: Directory(root)); //
files = await fm.filesTree(
excludedPaths: ["/storage/emulated/0/Android"],
extensions: ["pdf"] //optional, to filter files, list only pdf files
);
setState(() {}); //update the UI
}
【问题讨论】:
-
您是否使用
flutter clean清理了项目?如果没有,请清理它并重新运行您的应用
标签: android firebase flutter dart permissions