flutter - 自 .dart_tool/package_config.json 文件生成后 pubspec.lock 文件已更改,请再次运行“pub get”
问题描述
我尝试使用自定义预测试脚本在 codemagic 上运行测试。这是我的预测试脚本:
#!/bin/sh
cd libraries
cd dependencies
flutter pub get
cd ..
cd core
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd ..
cd features
cd splash
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd proposal
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
但是当pre-test
运行时,我得到这个错误:
Running "flutter pub get" in dependencies... 2.5s
Running "flutter pub get" in core... 4.9s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65
Running "flutter pub get" in splash... 3.0s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65
Running "flutter pub get" in proposal... 3.2s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65
Build failed :|
Step 4 script `Pre-test script` exited with status code 65
我认为这个错误是因为flutter pub run build_runner build --delete-conflicting-outputs
我想.g.dart
通过 codemagic 生成文件。
我尝试谷歌但仍未找到解决方案,有人可以帮我解决codemagic上的这个错误吗?
解决方案
我用 add 修复了flutter pub run
两次。
#!/bin/sh
cd libraries
cd dependencies
flutter pub get
cd ..
cd core
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd ..
cd features
cd splash
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd proposal
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
推荐阅读
- html - 输入类型文件导致长时间加载
- c# - 如何修复以下显示此错误的代码
- java - 选择具有所有 IN 列表引用的行
- codeigniter - 无法使用使用回调的 codeigniter 验证来验证文本字段
- r - 波浪号运算符可用于构建匿名函数的一般性有哪些?
- azure - 如何在注册期间将用户添加到 Azure AD B2C 中的不同组
- android - 在项目 ':@unimodules_react-native-adapter' 中找不到路径为 ':unimodules-core' 的项目
- amazon-web-services - Kinesis Firehose - S3 备份 - 不工作 - 数据未移动到 s3 备份文件夹
- ruby - 如何在 Ruby 中返回当前帧?
- python - 将文件的格式化内容保存到Python中的另一个文件