Reviving Stale Flutter App For iOS and Android
I have a Flutter app I developed couple years back, PictureVert (source code: https://github.com/hydralien/PictureVert). It had been collecting proverbial dust for a while, so I decided to build ad deploy fresh packages for both iOS and Android.
So I needed to figure out how to update everything and make it work again.
- Install fresh Flutter and set its path in the
PATHvariable (in e.g.
flutter pub outdatedand
flutter pub upgrade(I had to do those iteratively because one points to another, but once is actually enough)
- Add new versions of stale packages via
flutter pub add packagename anotherpackagename ...
flutter pub outdatedagain - it seemed to have different concerns this time around
- Add what's missing via
flutter pub addand
flutter pub upgrade
flutter doctorto see all is well
Building for iOS got simpler, though requires some pre-steps:
Accept XCode license agreement
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch sudo xcodebuild -license
xcodebuild -downloadPlatform iOS open -a Simulator cd ios; pod install; cd ..
Build and install
flutter build ipa
At the end of teh build, some useful guidance is provided:
Built IPA to /Users/halien/devel/picturevert/build/ios/ipa. To upload to the App Store either: 1. Drag and drop the "build/ios/ipa/*.ipa" bundle into the Apple Transporter macOS app https://apps.apple.com/us/app/transporter/id1450874784 2. Run "xcrun altool --upload-app --type ios -f build/ios/ipa/*.ipa --apiKey your_api_key --apiIssuer your_issuer_id". See "man altool" for details about how to authenticate with the App Store Connect API key.
I decided to use the "Apple Transporter" way (#1) and it worked surprisingly smooth - the build appeared in the App Store Connect immediately, ready for testing and being plugged to a release, so I just needed to provide an info about teh update and submit it for review.
First, Google Play Store Console required updating the SDK versions, so in
android/local.properties I needed to set
Then, things with Android were not that smooth -
flutter build appbundle started complaining seemingly about one of the dependencies:
* What went wrong: A problem occurred evaluating project ':share_plus'. > No signature of method: build_bkr51e9abrzl3n3k84uhu79f3.android() is applicable for argument types: (build_bkr51e9abrzl3n3k84uhu79f3$_run_closure2) values: [build_bkr51e9abrzl3n3k84uhu79f3$_run_closure2@94bf7f9]
But that's a deception: apparently the problem is incompatibility with old Gradle plugin, but to which version to update was unclear.
So I ended up doing
flutter create newproject elsewhere, and then copying the supported versions from it:
ext.kotlin_version = '1.7.10'and the
flutter build appbundle had finally succeeded.
I also copied
sdk: '>=3.1.3 <4.0.0' from
pubspec.yaml of a fresh Flutter app, just to be sure.