Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Running "flutter pub get" in sunloginclient...
Resolving dependencies...
Because XXX(项目工程名) depends on integration_test from sdk which doesn't exist (unknown SDK "ohos/har/integration_test.har"), version solving failed.
pub get failed
command: "D:\HuaWei\flutter_flutter\bin\cache\dart-sdk\bin\dart __deprecated_pub --directory . get --example"
pub env: {
"FLUTTER_ROOT": "D:\XXX\flutter_flutter",
"PUB_ENVIRONMENT": "vscode.dart-code:flutter_cli:verify:run",
"PUB_CACHE": "C:\Users\aiken\AppData\Local\Pub\Cache",
}
exit code: 69
因为要添加新的插件库,所以清理了pub缓存文件,导致一直报上面的错误。同事说是鸿蒙的Bug。在2024/8/30号左右的版本出险率很高。
解题思路如下:
1.将工程文件和flutter的架构目录文件保持同一磁盘。
2.更改所有的环境变量地址,保持和flutter磁盘目录相同(同一磁盘即可)。
3.重新拉取下pub
flutter pub get
下面是我的全部操作步骤
PS C:\Users\aiken\Documents\XXX> flutter pub get
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Running "flutter pub get" in sunloginclient...
Resolving dependencies...
Because sunloginclient depends on integration_test from sdk which doesn't exist (unknown SDK "ohos/har/integration_test.har"), version solving failed.
pub get failed
command: "C:\Users\aiken\Documents\flutter_flutter\bin\cache\dart-sdk\bin\dart __deprecated_pub --color --directory . get --example"
pub env: {
"FLUTTER_ROOT": "C:\Users\aiken\Documents\flutter_flutter",
"PUB_ENVIRONMENT": "flutter_cli:get",
"PUB_CACHE": "C:\Users\aiken\AppData\Local\Pub\Cache",
}
exit code: 69
我是按照上面的步骤解决了问题,如果解决不了可以考虑在Flutter磁盘下重新下载一份工程文件试试。
- 提示错误缓存文件和Flutter 框架文件不在一个目标文件下面。可能是因为之前缓存的地址没有清除。将框架地址和缓存地址放到同一目录下即可,或者是保持旧的地址(Windows下是系统环境变量的地址)环境变量。
注意 integration_test 配置一定要保持默认配置地址
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
也可以配置FLUTTER_ROOT