Can't load images in when running emmulator/physical device

Viewed 33

This is the error I am getting:

    Target debug_android_application failed: FileSystemException: Cannot copy file to 'X:\Flutter\projects\practice_draw_screen\build\app\intermediates\flutter\debug\flutter_assets\images/IMG_2706.jpg', path = 'X:\Flutter\projects\practice_draw_screen\images\IMG_2706.jpg' (OS Error: The process cannot access the file because it is being used by another process.
, errno = 32)
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\Matt\Flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\Matt\Flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
Exception: Gradle task assembleDebug failed with exit code 1

flutter doctor:

    Microsoft Windows [Version 10.0.18363.900]
(c) 2019 Microsoft Corporation. All rights reserved.

X:\Flutter\projects\practice_draw_screen>flutter doctor -v
[√] Flutter (Channel stable, v1.17.4, on Microsoft Windows [Version 10.0.18363.900], locale en-CA)
    • Flutter version 1.17.4 at C:\Users\Matt\Flutter
    • Framework revision 1ad9baa8b9 (11 days ago), 2020-06-17 14:41:16 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\Matt\AppData\Local\Android\Sdk
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = C:\Users\Matt\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 47.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Community Edition (version 2019.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.1
    • Flutter plugin version 45.0.2
    • Dart plugin version 193.6911.31

[√] VS Code (version 1.45.1)
    • VS Code at C:\Users\Matt\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.10.2

[√] Connected device (1 available)
    • Pixel 3a • 94SAY0SNC1 • android-arm64 • Android 10 (API 29)

• No issues found!

I have tried running flutter -clean but I get the same error. In windows explorer my folder containing the images is not checked as read-only but there is a filled-in box beside 'read-only'. When I uncheck the filled in box it applies the changes to the files but when I look at the properties again the box is filled in (not a check mark).

1 Answers

I ended up deleting the pictures and using different images which made it work. I am not sure why it did this tho.

Related