Gradle task fail - Invalid depfile

4,302

Solution 1

To use flutter clean redirect yourself (cd..) into the folder where your pubspec.yaml file is located. I am currently facing the same issue, but this takes away the "invalid deepfile" issue.

Solution 2

Remove that Dart.html file and run your project. It will work

Share:
4,302
Admin
Author by

Admin

Updated on December 17, 2022

Comments

  • Admin
    Admin over 1 year

    I am a complete beginner at all of this and trying to half-teach myself, so please give advice step by step.

    I'm trying to make an app using Android Studio and Flutter on Windows. When I try to run my app through the emulator (I'm using genymotion as I have a Ryzen cpu) here's what the console says:

    Invalid depfile: C:\Users\me\AndroidStudioProjects\i_am_rich\.dart_tool\flutter_build\483fc1f7e1eeed45c31ebc61a3e78ae0\kernel_snapshot.d
    Invalid depfile: C:\Users\me\AndroidStudioProjects\i_am_rich\.dart_tool\flutter_build\483fc1f7e1eeed45c31ebc61a3e78ae0\kernel_snapshot.d
    
    Compiler message:
    lib/main.dart:1:8: Error: Not found: 'dart:html'
    import 'dart:html';
       ^
    /C:/src/flutter/flutter/packages/flutter/lib/src/painting/_network_image_web.dart:64:12: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
    return ui.webOnlyInstantiateImageCodecFromUrl(resolved); // ignore: undefined_function
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    U
    nhandled exception:
    FileSystemException(uri=org-dartlang-u
    ntranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
    #0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/stan
    dard_file_system.dart:33:7)
    #1      asFileUri (package:vm/kernel_fron
    t_end.dart:604:37)
    #2      writeDepfile (package:vm/kernel_front_end.da
    rt:799:21)
    <asynchronous suspension>
    #3      FrontendCompiler.comp
    ile (package:frontend_server/frontend_server.dart:472:15)
    <asynch
    ronous suspension>
    #4      _FlutterFrontendCompiler.compile (package:flutt
    er_frontend_server/server.dart:38:22)
    #5      starter (package:flu
    tter_frontend_server/server.dart:149:27)
    #6      main (file://
    /C:/b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
    
    #7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
    #8      _Ra
    wReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
    
    Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
    build failed.
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
    
    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command 'C:\src\flutter\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 33s
    Finished with error: Gradle task assembleDebug failed with exit code 1
    

    When I run flutter doctor this in the console:

    Doctor summary (to see all details, run flutter doctor -v):
    [√] Flutter (Channel stable, v1.12.13+hotfix.7, on Microsoft Windows [Version 10.0.18363.592], locale 
    en-AU)
    
    [√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    [√] Android Studio (version 3.5)
    [√] Connected device (1 available)
    
    • No issues found!
    

    And when I attempt flutter clean:

    Error: No pubspec.yaml file found.
    This command should be run from the root of your Flutter project.
    Do not run this command from the root of your git clone of Flutter.
    

    My flutter console is in C:\src\flutter\flutter. I really have no idea what I'm doing or how to fix this, and I'm feeling a little disheartened! Any advice would be wonderful. Thank you.