4

最近,当我尝试调试时,我的代码意外停止编译。我正在运行 Flutter v0.5.1

我能想到解释这一点的唯一原因是在我将 Flutter SDK 从桌面移动到单独的文件夹之后发生了这种情况。

这是我收到的错误:

Error reading dependency file C:\Users\Jake\Desktop\Other\Flutter\myproject\build\app\intermediates\flutter\debug\snapshot_blob.bin.d: java.lang.ArrayIndexOutOfBoundsException: 1
Error reading dependency file C:\Users\Jake\Desktop\Other\Flutter\myproject\build\app\intermediates\flutter\debug\snapshot_blob.bin.d: java.lang.ArrayIndexOutOfBoundsException: 1
Error reading dependency file C:\Users\Jake\Desktop\Other\Flutter\myproject\build\app\intermediates\flutter\debug\snapshot_blob.bin.d: java.lang.ArrayIndexOutOfBoundsException: 1
Oops; flutter has exited unexpectedly.
Crash report written to C:\Users\Jake\Desktop\Other\Flutter\myproject\flutter_14.log;
please let us know at https://github.com/flutter/flutter/issues.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\Jake\Desktop\flutter_windows_v0.5.1-beta\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 435
* What went wrong:
Execution failed for task ':app:flutterBuildDebug'.
> Process 'command 'C:\Users\Jake\Desktop\flutter_windows_v0.5.1-beta\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.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
Gradle build failed: 1
Exited (sigterm)

这是转储到文件夹中的 Flutter Log myproject

Flutter crash report; please file at https://github.com/flutter/flutter/issues.

## command

flutter build bundle --suppress-analytics --target C:\Users\Jake\Desktop\Other\Flutter\myproject\lib\main.dart --preview-dart-2 --filesystem-scheme org-dartlang-root --depfile C:\Users\Jake\Desktop\Other\Flutter\myproject\build\app\intermediates\flutter\debug/snapshot_blob.bin.d --asset-dir C:\Users\Jake\Desktop\Other\Flutter\myproject\build\app\intermediates\flutter\debug/flutter_assets

## exception

RangeError: RangeError (index): Invalid value: Only valid value is 0: 1

```
#0      List.[] (dart:core-patch/dart:core/growable_array.dart:141)
#1      readDepfile (package:flutter_tools/src/base/fingerprint.dart:174)
<asynchronous suspension>
#2      Fingerprinter._getPaths (package:flutter_tools/src/base/fingerprint.dart:88)
<asynchronous suspension>
#3      Fingerprinter.doesFingerprintMatch (package:flutter_tools/src/base/fingerprint.dart:60)
<asynchronous suspension>
#4      KernelCompiler.compile (package:flutter_tools/src/compile.dart:104)
<asynchronous suspension>
#5      build (package:flutter_tools/src/bundle.dart:79)
<asynchronous suspension>
#6      BuildBundleCommand.runCommand (package:flutter_tools/src/commands/build_bundle.dart:72)
<asynchronous suspension>
#7      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:344)
<asynchronous suspension>
#8      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:279)
<asynchronous suspension>
#9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142)
<asynchronous suspension>
#10     _rootRun (dart:async/zone.dart:1126)
#11     _CustomZone.run (dart:async/zone.dart:1023)
#12     runZoned (dart:async/zone.dart:1501)
#13     AppContext.run (package:flutter_tools/src/base/context.dart:141)
<asynchronous suspension>
#14     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:270)
#15     CommandRunner.runCommand (package:args/command_runner.dart:194)
<asynchronous suspension>
#16     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:309)
<asynchronous suspension>
#17     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142)
<asynchronous suspension>
#18     _rootRun (dart:async/zone.dart:1126)
#19     _CustomZone.run (dart:async/zone.dart:1023)
#20     runZoned (dart:async/zone.dart:1501)
#21     AppContext.run (package:flutter_tools/src/base/context.dart:141)
<asynchronous suspension>
#22     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:265)
<asynchronous suspension>
#23     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109)
#24     new Future.sync (dart:async/future.dart:222)
#25     CommandRunner.run (package:args/command_runner.dart:109)
#26     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:174)
#27     run.<anonymous closure> (package:flutter_tools/runner.dart:59)
<asynchronous suspension>
#28     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142)
<asynchronous suspension>
#29     _rootRun (dart:async/zone.dart:1126)
#30     _CustomZone.run (dart:async/zone.dart:1023)
#31     runZoned (dart:async/zone.dart:1501)
#32     AppContext.run (package:flutter_tools/src/base/context.dart:141)
<asynchronous suspension>
#33     runInContext (package:flutter_tools/src/context_runner.dart:43)
<asynchronous suspension>
#34     run (package:flutter_tools/runner.dart:50)
#35     main (package:flutter_tools/executable.dart:49)
<asynchronous suspension>
#36     main (file:///E:/b/build/slave/Windows_Flutter_Packaging/build/archive/flutter/packages/flutter_tools/bin/flutter_tools.dart:8)
#37     _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:277)
#38     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)
```

## flutter doctor

```
[✓] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version 10.0.17134.228], locale en-GB)
    • Flutter version 0.5.1 at C:\Users\Jake\Desktop\flutter_windows_v0.5.1-beta\flutter
    • Framework revision c7ea3ca377 (3 months ago), 2018-05-29 21:07:33 +0200
    • Engine revision 1ed25ca7b7
    • Dart version 2.0.0-dev.58.0.flutter-f981f09760

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\Jake\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
    • All Android licenses accepted.

[✓] Android Studio (version 3.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[!] VS Code, 64-bit edition (version 1.25.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected devices (1 available)
    • HTC Desire 510 • CC58XY408727 • android-arm • Android 4.4.3 (API 19)

! Doctor found issues in 1 category.
```

错误;✗ Flutter plugin not installed; ✗ Dart plugin not installed应该不是问题,它们都是根据 VSCode 安装的,显然这个问题,由于不被识别的区分大小写的值flutter doctor,会影响 VSCode 上的每个人。

4

5 回答 5

8

在 Günter 提出flutter clean.

于 2018-08-15T12:09:05.147 回答
3

按照以下步骤问题将得到修复 使用以下命令将您的 Flutter 频道更改为 Master

颤振通道大师

执行以下命令

扑跑

问题将得到解决,您的飞镖版本将被更新

于 2019-11-30T09:35:32.750 回答
2

我在 ubuntu 20.04 中遇到了同样的问题,我将路径更改为没有空间的目录,现在问题已解决。

于 2020-07-28T03:23:17.357 回答
1

请执行以下步骤。这对我有用。仅适用于 Mac 用户。

第 1 步:在 Mac 中删除 Podfiles

       i) rm ios/Podfile
      ii) rm ios/Podfile.lock

第 2 步:运行flutter clean。它将删除构建文件夹并清理项目。

第三步:通过flutter run生成Podfiles

注意:不要使用Pod init来生成 Podfile,因为它不会创建任何依赖项。

可选步骤 4:如果 Podfiles 已经生成,那么我们可以通过pod installpod update对其进行更新。另外请确保您在 ios 文件夹中。

   i)   cd ios
   ii)  pod install
   iii) pod update

注意:请确保 flutter_svg 依赖项在 pubspec.yaml 中应为 flutter_svg: ^0.18.0

于 2020-09-29T09:38:56.183 回答
1

要修复它,请删除项目中的 /build 文件夹,错误在哪里,然后点击以下命令:

flutter clean

然后:

flutter run
于 2020-10-03T03:05:53.787 回答