I try to run test on codemagic with custom pre-test script. And this is my pre-test script:
#!/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
And this I my flutter project structure:
But when the pre-test
is running, I get this error:
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
I think this error is because of flutter pub run build_runner build --delete-conflicting-outputs
when I want generated .g.dart
file via codemagic.
I try to google but still not found a solution, can someone help me how to solve this error on codemagic?
I fix with add flutter pub run
twice.
#!/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