I am trying to learn Flutter. My problem is that when I run my flutter project for the first time it runs and installs successfully on the device, but if I disconnect the device and rerun the project it gives an error.
I am trying to display images in my app.
When I run flutter clean
or flutter clean build
or flutter clean cache
and rerun the project it does not gives the error, then after disconnecting the device the problem occurs again.
I searched google for hours but it did not help me.
this the the error:
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'.
flutter doctor -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!