【问题标题】:The flutter tool cannot access the fileflutter工具无法访问文件
【发布时间】:2021-03-20 12:56:51
【问题描述】:

我尝试运行 Flutter 项目但出现错误

Flutter failed to write to a file at
"C:\Users\Dell\flutter-development\projects\flutter_complete_guide\ios\Runner\GeneratedPluginRegistrant.h". The flutter
tool cannot access the file.
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current
user.

版本:

颤振 1.22.4,

Windows 10

我尝试用 cmd 和 android-studio 创建一个 Flutter 项目,但结果是一样的。

我也为所有(包括戴尔用户)的flutter-sdk目录、flutter项目及其子目录授予了完全权限。

曾经尝试使用 flutter create myapp 从头开始​​构建项目 获取下一个错误

PS C:\src1\project> flutter create myapp
Recreating project myapp...
  myapp\android\app\src\main\res\mipmap-mdpi\ic_launcher.png (created)
Failed to send crash report due to a network error: SocketException: OS Error: Access is denied.
, errno = 5, address = clients2.google.com, port = 63568
Oops; flutter has exited unexpectedly: "FileSystemException: Cannot copy file to 'C:\src1\project\myapp\android\app\src\main\res\mipmap-mdpi\ic_launcher.png', path =
'C:\src1\flutter\packages\flutter_tools\templates\app\android.tmpl\app\src\main\res\mipmap-mdpi\ic_launcher.png' (OS Error: Access is denied.
, errno = 5)".

【问题讨论】:

    标签: android android-studio flutter permissions windows-10


    【解决方案1】:
    Flutter failed to write to a file at
    "C:\Users\Dell\flutter-development\projects\flutter_complete_guide\ios\Runner\GeneratedPluginRegistrant.h". The flutter
    tool cannot access the file.
    Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current
    user.
    

    确保您拥有 Flutter 安装文件夹的所有权。签出this

    OS Error: Access is denied.
    , errno = 5
    

    错误 5:访问被拒绝是 Windows 10 上的一个已知问题。此错误 阻止您在计算机上安装软件并访问 或修改某些文件。

    此问题的原因是权限不可用。 如果您没有安装 Windows 10 将阻止您安装 管理员权限,或者如果您的帐户不是管理员 帐户。

    Getting administrator privileges for your account on the computer solves this problem.

    【讨论】:

      【解决方案2】:

      我花了 5 天时间来解决这个问题。

      • 我重置了我的 Windows 10,但它不起作用。
      • 我升级到 Windows 11 并希望它可以接管权限 或任何东西,但仍然没有工作。
      • 直到我尝试将我的颤振项目备份到谷歌驱动器然后 重新下载它。它结束了工作。

      我想要解决这个问题,您只需要通过重新创建每个文件来重置文件夹属性。在我的情况下,通过云存储

      【讨论】:

        猜你喜欢
        • 2021-05-28
        • 2021-09-12
        • 1970-01-01
        • 2022-11-27
        • 2021-11-07
        • 1970-01-01
        • 2022-01-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多