【问题标题】:Cannot see application folder in Android/data while installing with flutter使用颤振安装时看不到 Android/data 中的应用程序文件夹
【发布时间】:2020-08-25 07:16:59
【问题描述】:
Future get _localPath async {
final Directory directory = await getApplicationDocumentsDirectory();
return directory.path;
}

Future _createDirectory() async {
final String path = await _localPath;
final Directory directory = await Directory('$path/CapturedImages').create(recursive: true);
print("The directory $directory is created");
}

D/EGL_emulation(14006): eglMakeCurrent: 0xeaff6780: ver 3 1 (tinfo 0xc942c8e0) I/flutter (14006): 目录Directory: '/data/user/0/quadauq.ffmpeg_examplebyneena/app_flutter/CapturedImages' 被创建 D/EGL_emulation(14006): eglMakeCurrent: 0xeafc6d40: ver 3 1 (tinfo 0xdf9af9b0)

显示为成功,但我在 Andrid/data 的任何位置都看不到应用程序文件夹或创建的文件夹 - 谁能帮忙?

【问题讨论】:

    标签: file flutter android-emulator


    【解决方案1】:

    您可以请求存储目录:

    Future get _localPath async {
      final Directory directory = await getExternalStorageDirectory();
      return directory.path;
    }
    

    而不是应用程序文档目录。

    所以,你可以在Android/data/quadauq.ffmpeg_examplebyneena/files/CapturedImages看到应用程序创建的文件夹

    【讨论】:

    • 对不起,我的意思是在模拟器中,我在 Android/data 中看不到包文件夹
    • 即使在 Android 设备上安装后,手动查看时也看不到应用目录。在分析包时,它看起来应该是/data/app/<packagename>,但仍然没有找到它
    • 好吧,看起来 Flutter 应用程序不会在内部存储中创建自己的应用程序特定文件夹,如果你想你必须使用 path_providerpub.dev/packages/path_provider跨度>
    猜你喜欢
    • 2020-11-28
    • 2018-08-18
    • 1970-01-01
    • 2020-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多