【发布时间】:2020-05-11 15:09:18
【问题描述】:
我正在努力学习 Flutter。我的问题是,当我第一次运行我的颤振项目时,它会在设备上成功运行并安装,但是如果我断开设备并重新运行项目,则会出现错误。
我正在尝试在我的应用中显示图像。
当我运行flutter clean 或flutter clean build 或flutter clean cache 并重新运行项目时,它没有给出错误,然后在断开设备连接后问题再次出现。
我在谷歌上搜索了几个小时,但对我没有帮助。
这是错误:
Target debug_android_application failed: FileSystemException: Cannot copy file to 'G:\Flutter
Projects\my_practice_7\build\app\intermediates\flutter\debug\flutter_assets\images\image.png',
path = 'G:\Flutter Projects\my_practice_7\images\image.png'
(OS Error: Access is denied.
, errno = 5)
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'G:\Android\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
颤振医生-v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.476], locale en-GB)
• Flutter version 1.12.13+hotfix.5 at G:\Android\flutter
• Framework revision 27321ebbad (7 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at G:\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = G:\Android\Sdk\
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.41.1)
• VS Code at C:\Users\HP\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.7.1
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
【问题讨论】:
-
是否有另一个打开该文件的进程?愚蠢的建议,但尝试重新启动?
-
@OldProgrammer 没有。
-
我也面临这个问题。每次运行/构建应用程序之前,我都必须运行“flutter clean”。等待永久解决。这也是一个相关的帖子:stackoverflow.com/questions/59450634/…
-
@SureshKumar 这很烦人。我想到的一切我都做了,但没有运气。我尝试修改权限和所有者等 ?????????
-
我也面临同样的问题