gpt4 book ai didi

android - Flutter "packages get"失败,错误 "Couldn' t 读取文件本地文件...”

转载 作者:行者123 更新时间:2023-12-03 20:57:01 25 4
gpt4 key购买 nike

我有一个 Flutter 项目,一天到另一天我无法运行 packages get了。它失败了:

Couldn't read file LocalFile: 'LOCAL_FLUTTER_SDK_PATH\flutter.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.6\android\src\main\kotlin\io\flutter\plugins\flutter_plugin_android_lifecycle\FlutterAndroidLifecyclePlugin.kt' even though it exists. Please verify that this file has read permission and try again.



同样构建应用程序是因为那一刻不再可能,它失败并出现同样的错误。

我的 pubspec.yaml :
name: my_app
description: My fancy cross plattform app

version: 1.0.0+2

environment:
sdk: ">=2.3.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
flutter_cupertino_localizations: ^1.0.1
http: ^0.12.0+2
sqflite:
path:
crypto: ^2.1.3
flutter_typeahead: ^1.7.0
image_picker: 0.3.0
google_maps_flutter: any
http_parser: ^3.1.3
cupertino_icons: ^0.1.2

dev_dependencies:
flutter_test:
sdk: flutter
intl_translation: ^0.17.7

flutter:
assets:
- assets/
- assets/img/

uses-material-design: true

请注意,我创建了一个新项目,只是使用相同的 pubspec.yaml。文件,一切正常。如果您知道我的项目中的哪个可能导致此错误,请告诉我我将添加该源代码,因为 pubspec.yaml似乎不是原因,或者至少不是唯一的原因。

我有最新的 Flutter 版本(v1.12.13+hotfix.8)

最佳答案

我遇到了类似的问题。每当我运行时,flutter pub get 都会出现以下错误

flutter Couldn't read file LocalFile: .... flutter_plugin_android_lifecycle\FlutterAndroidLifecyclePlugin.kt' even though it exists. Please verify that this file has read permission and try again.

所以,我运行这两个命令:

flutter clean
flutter pub cache repair

在运行第二个命令时,我注意到了这个新问题:

Failed to repair flutter_plugin_android_lifecycle 1.0.7. Error:
FileSystemException: Deletion failed, path = ...\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.7' (OS Error: The system cannot find the path specified.

然后,按照 Packages GET failes with The plugin flutter_plugin_android_lifecycle ,我删除了 flutter 目录中的 .pub-cache 文件夹

之后,我跑
flutter pub get

最后,一切重新开始工作。

关于android - Flutter "packages get"失败,错误 "Couldn' t 读取文件本地文件...”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60480786/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com