This article will summarize some of the problems that have been encountered with the current upgrade of Flutter 2.10.

As a matter of fact, according to the rule that every version of Flutter is put into use, the third minor version should be the most stable. Given the large number of users of Flutter at present, every release of the official version of Flutter is bound to bring various strange problems. In general, I recommend that version 2.10 be put into production until version 2.10.3 is released. But if you can’t wait for the official Hotfix, this may help.

If you upgrade from 2.8 to 2.10 this time, the DART layer needs to be adjusted almost to nothing.

Kotlin version

The first and most important upgrade for your project is to upgrade your version of the Kotlin plugin. This is mandatory because previous versions of Flutter use 1.3.x, while this version of Flutter 2.10 requires 1.5.31 or higher.

buildscript {
-    ext.kotlin_version = '1.3.50'
+    ext.kotlin_version = '1.5.31'
Copy the code

Note that this update to the Kotlin version will break some of the Kotlin package apis, so if your App uses Kotlin a lot, or your plugin uses Kotlin packages, You need to pay attention to the adaptation cost of the upgrade, for example:

ProducerScope needs to override the new trySend method, but this method needs to return a ChannelResult, which is @internalCoroutinesAPI.

Gradle version

Since the Kotlin version has been upgraded, AGP plug-ins must use a minimum 4.0.0 Gradle 6.1.1 version:

classpath 'com. Android. Tools. Build: gradle: 4.0.0'
 /
distributionUrl=https:/ / services.gradle.org/distributions/gradle-6.1.1-all.zip
Copy the code

Since the AGP used in previous versions may be AGP 3.x with Gradle 5.x, this step is necessary if the Kotlin version is upgraded.

Here is a screenshot of AGP and Gradle versions

The Android SDK problem

cmdline-tools & license

This problem may not occur to you. First of all, if you perform the flutter Doctor, the following situation occurs

[!] Those who qualify can go onto those who qualify. Android Toolchain - Develop for Android Devices (Android SDK Version 31.0.0) Qualify CMdline-tools component is missing Run `path/to/sdkmanager --install "cmdline-tools; The latest "` See https://developer.android.com/studio/command-line for more details. ✗ Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.Copy the code

So if CMdLine-Tools and Android License can go onto those who qualify, then you may need to go onto extra steps to qualify.

First you need to install cmdline-tools, as shown below

Then execute Flutter Doctor — Android-Licenses to easily complete the configuration of your environment.

Build Tools

When you error updating an Error like: Installed Build Tools Revision 31.0.0 is Corrupted:

Could not determine the dependencies of task ": app: compileDebugJavaWithJavac '. > Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.Copy the code

To complete the configuration, run the following command:

# change below to the Android SDK path CD ~ / Library/Android/SDK/build tools / 31.0.0 \ && mv d8 dx CD lib \ \ & & & mv d8.jar dx.jarCopy the code

Windows users can see stackoverflow.com/questions/6…

NDK

If you have No version of NDK matched problem during compilation:

Execution failed for task ': app: stripDebugDebugSymbols'. > No version of the NDK matched the requested version 21.0.6113669. Versions available locally: 19.1.5304403Copy the code

This problem is actually very simple, as shown in the figure open your SDK Manager to download the corresponding version.

Local AAR file problem

There is a problem with the AGP update that only exists in the local AAR file that you are using in the Flutter Plugin.

You would normally get an if at compile time:

> Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :********* project caused this error: /Users/guoshuyu/.pub-cache/git/*********-01d03bf549e512f6e15dd539411a8c236d77cd47/android/libs/libc*********.aar, /Users/guoshuyu/.pub-cache/git/*********-01d03bf549e512f6e15dd539411a8c236d77cd47/android/libs/*********.aar, /Users/guoshuyu/.pub-cache/git/*********-01d03bf549e512f6e15dd539411a8c236d77cd47/android/libs/*********.aar
Copy the code

At this time listen to my advice, what way is not good, directly take a private server Maven, very simple, upload aar, and then remote dependency can come in.

Mandatory V2

Android is compulsory for V2 in this version, for example, if before using the Android: name = “IO. Flutter. App. FlutterApplication”, then you will see at compile time:

━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ Warning ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ Your Flutter application is created using  an older version of the Android embedding. It is being deprecated in favor of Android embedding v2. Follow the steps at  https://flutter.dev/go/android-project-migration to migrate your project. You may also pass the --ignore-deprecation flag to ignore this check and continue with the deprecated v1 embedding. However, the v1 Android embedding will be removed in future versions of Flutter. ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ The detected reason was: /Users/guoshuyu/workspace/***/*********/android/app/src/main/AndroidManifest.xml uses `android:name="io.flutter.app.FutterApplication"` ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━Copy the code

Here if you simply delete the android: name = “IO. Flutter. App. FutterApplication” is ok.

More information about V2 can be found in flutter. Dev /go/android-…

The Material icon is abnormal

There was an upgrade for The Material Icon on Flutter 2.10. Obviously, this release created another hole. The current problem seems to be due to the rollback of an issue, which resulted in some Icon submissions being rolled back, so this part can only wait for hotfix. At present, the problem has been officially known, which can be seen as follows:

Github.com/flutter/flu…

iOS CocoaPods not installed

If you run iOS and get an error message from CocoaPods not Installed, don’t worry, this is the Android Studio team’s pot.

Warning: CocoaPods not installed. Skipping pod install.
  CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
  Without CocoaPods, plugins will not work on iOS or macOS.
  For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

Exception: CocoaPods not installed or not in valid state.
Copy the code

When you execute flutter Doctor, you may see that you lack CocoaPods locally, but you actually have CocoaPods locally. There are several possible solutions to this problem:

  • Directly from the command lineflutter runRunning doesn’t have this problem;
  • Through the command lineopen /Applications/Android\ Studio.appStart Android Studio;
  • performchmod +x /Applications/Android\ Studio.app/Contents/bin/printenv(If you use itJetBrains ToolboxthatprintenvFile path may change)
  • Wait for minor updates to Android Studio

For more information: github.com/flutter/flu…