· flutter · 2 min read
Upgrade Flutter to 3.27.1 from 3.24.0
Which issues I encounter while upgrading
I’m using codemagic to deploy my latest app “Pickleball Eye Trainer” (a blog post about it soon) and this morning after merging the latest feature (Achievements) in the main (which trigger the build) - Exception!
The build for Android is not working anymore; FlutterFix tell me that it’s time to upgrade :)
Usually, Flutter Upgrade are not too painfull (We won’t speak about the null safety one) compared to when I was working with React-Native but this one was a bit annoying!
So, I upgraded Flutter to the latest version and here are the issues I got and how I manage to fix them.
iOS side
The usual
Command PhaseScriptExecution failed with a nonzero exit code
/Users/SomeWhereOnMyDisk/Projects/Private/FlutterApp/xxx/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.2.99. (in target 'wakelock_plus-wakelock_plus_privacy' from project 'Pods')
/Users/SomeWhereOnMyDisk/Projects/Private/FlutterApp/xxx/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.2.99. (in target 'leveldb-library-leveldb_Privacy' from project 'Pods')
...
Failed to build iOS app
Error output from Xcode build:
↳
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
2
{ platform:iOS Simulator, id:CBF589E5-152F-4B09-A40D-0E4E4C489186, OS:18.2, name:iPhone 16 Plus }
** BUILD FAILED **
The only way I had to fix that was to delete the ios project and recreate it … very annoying
Android side
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
aapt2 E 12-21 13:38:45 1896 28729 LoadedArsc.cpp:94] RES_TABLE_TYPE_TYPE entry offsets overlap actual entry data.
aapt2 E 12-21 13:38:45 1896 28729 ApkAssets.cpp:149] Failed to load resources table in APK '/usr/local/share/android-sdk/platforms/android-35/android.jar'.
error: failed to load include path /usr/local/share/android-sdk/platforms/android-35/android.jar.
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.version-check'.
> Minimum supported Gradle version is 8.0. Current version is 7.6.3. If using the gradle wrapper, try editing the distributionUrl in /Users/SomeWhereOnMyDisk/Projects/Private/FlutterApp/xx/android/gradle/wrapper/gradle-wrapper.properties to gradle-8.0-all.zip
* What went wrong:
Execution failed for task ':app:compileReleaseKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (1.8) and 'compileReleaseKotlin' (17).
Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation
To fix that issue, I created a new flutter project on the side, compare and copy all the versions for gradle, kotlin, and a new settings kotlinOptions was there in the build.gradle (the one from app).
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
Good luck for your upgrade!