在 arch Linux 上构建 flutter 项目出现错误:“Dart 错误:无法加载内核二进制文件:SDK 哈希无效。” [重复]

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

所有错误信息:

[ERROR:flutter/shell/common/shell.cc(117)] Dart Error: Can't load Kernel binary: Invalid SDK hash.
[ERROR:flutter/runtime/dart_isolate.cc(144)] Could not prepare isolate.
[ERROR:flutter/runtime/runtime_controller.cc(462)] Could not create root isolate.
[ERROR:flutter/shell/common/shell.cc(669)] Could not launch engine with configuration.

扑医生信息

    • Flutter version 3.19.6 on channel stable at /home/bluearc/local/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (2 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/google-chrome-stable

[✓] Linux toolchain - develop for Linux desktop
    • clang version 17.0.6
    • cmake version 3.29.2
    • ninja version 1.11.1
    • pkg-config version 2.1.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Arch Linux 6.6.8-arch1-1
    • Chrome (web)    • chrome • web-javascript • Google Chrome 122.0.6261.111

[✓] Network resources
    • All expected network resources are available.

首先,我错误地删除了我的 Flutter SDK 文件夹。然后,我使用 flutter.dev 的新版本 SDK 重新安装了它,但忘记在重新安装之前删除配置文件和缓存。现在,每个针对 Linux 构建的 Flutter 项目(包括示例)都会遇到此错误,但 Web 构建没问题。之后,我删除了SDK并删除了所有配置和缓存文件以重新安装,但它没有运行。

我将 Flutter 频道更改为

main
,但并没有解决问题。

我也尝试使用pacman重新安装Flutter SDK,但遇到了另一个错误:

Unexpected Kernel Format Version 117 (expected 114)
#0      BinaryBuilder.readComponent.<anonymous closure> (package:kernel/binary/ast_from_binary.dart:692)
#1      Timeline.timeSync (dart:developer/timeline.dart:173)
#2      BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:679)
#3      _InitializationFromSdkSummary._prepareSummary (package:front_end/src/fasta/incremental_compiler.dart:2503)
#4      _InitializationFromUri.initialize (package:front_end/src/fasta/incremental_compiler.dart:2577)
<asynchronous suspension>
#5      IncrementalCompiler._ensurePlatformAndInitialize (package:front_end/src/fasta/incremental_compiler.dart:1383)
<asynchronous suspension>
#6      IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:270)
<asynchronous suspension>
#7      CompilerContext.clear (package:front_end/src/fasta/compiler_context.dart:139)
<asynchronous suspension>
#8      IncrementalCompiler.compile (package:vm/incremental_compiler.dart:77)
<asynchronous suspension>
#9      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:610)
<asynchronous suspension>
#10     listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1303)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.

评论中的方法:https://aur.archlinux.org/packages/flutter-tool,无法解决。

我在那里看到了一个较小的问题:无法加载内核二进制文件:Flutter 中的 SDK 哈希无效,但有一些不同。就像:当我运行 dart fix 时,我没有收到错误,或者我没有另一个 Dart

我很快就会到达截止日期。非常感谢您的帮助。

linux flutter dart archlinux
1个回答
0
投票

我通过重新安装 Flutter SDK 3.19.3 解决了这个问题。一切正常。这是我的原始版本,也许我应该首先这样做。

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