Gradle任务失败-无效的depfile

问题描述 投票:4回答:1

我是一个完全的初学者,尝试对自己进行一半的学习,所以请逐步提供建议。

我正在尝试在Windows上使用Android Studio和Flutter制作应用。当我尝试通过模拟器运行我的应用程序时(我使用genymotion,因为我有Ryzen cpu),这是控制台的内容:

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

当我在控制台中运行Flutter Doctor时:

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!

当我尝试扑干净时:

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.

我的Flutter控制台位于C:\ src \ flutter \ flutter。我真的不知道我在做什么或如何解决这个问题,我感到有些沮丧!任何建议将是美好的。谢谢。

android android-studio gradle flutter genymotion
1个回答
0
投票

要使用flutter clean,请将您自己(cd ..)重定向到pubspec.yaml文件所在的文件夹中。我目前正面临着同样的问题,但这消除了“无效的Deepfile”问题。

© www.soinside.com 2019 - 2024. All rights reserved.