Currently, the stable version of Flutter has been upgraded to 1.12.*, which is quite different from before. There have been many online posts about the specific differences.

During the New Year, we made a transition from version 1.5.4, which has been used for a long time, to version 1.9.1, briefly listing the details.

1. Dart side API changes are minor

The code I use has only one change:

The old way:

final ImageStream stream = provider.resolve(config);
stream.addListener(listener, onError: errorListener);
completer.future.then((List<ImageInfo> _) { stream.removeListener(listener); });
Copy the code

A new way

final ImageStream stream = provider.resolve(config);
ImageStreamListener imageStreamListener = ImageStreamListener(listener ,onError: errorListener);
stream.addListener(imageStreamListener);
completer.future.then((List<ImageInfo> _) { stream.removeListener(imageStreamListener); });
Copy the code

It’s just a change in the number of parameters.


Second, compiling intermediate changes

This change started from 1.7.8. Check my previous posts, the four intermediates are no longer generated independently, and are now packaged into the SO file uniformly, which is more convenient for those who need to intervene in the packaging process.


Third, the change of packaging AAR

If you need to build a packaging AAR to synchronize to your Maven private server, there are minor changes to the previous packaging process (for example, based on 1.5.4).

Host projects with too many tripartite dependencies, you want to streamline package size, need compatible Cpu architecture, configuration only

ndk {
    abiFilters 'armeabi'
    }
Copy the code

But Flutter only supports armeabi-V7A, ARM64-V8A, x86, and x86-64 modes, resulting in your commands

flutter build aot --target lib/main.dart --target-platform android-arm
Copy the code

The result is not as expected, you do not have armeabi folder in JNI, so. You need two steps:

1 Move armeabiV7 to Armeabi
cd $FLUTTER_ROOT/bin/cache/artifacts/engine
for arch in android-arm android-arm-profile android-arm-release; do
  pushd $arch
  cp flutter.jar flutter-armeabi-v7a.jar # backup
  unzip flutter.jar lib/armeabi-v7a/libflutter.so
  mv lib/armeabi-v7a lib/armeabi
  zip -d flutter.jar lib/armeabi-v7a/libflutter.so
  zip flutter.jar lib/armeabi/libflutter.so
  popd
done
Copy the code

This will be available in the 1.5.4 era, but will be required for 1.9.1

2 Set the Flutter_gradle script

Will flutter/packages/flutter_tools/gradle/flutter gradle 52 lines

private static final String ARCH_ARM32      = "armeabi-v7a";
Copy the code

Instead of

private static final String ARCH_ARM32      = "armeabi";
Copy the code

That will do.


Four other

I upgraded my computer system to MAC 10.15 and there was an error after I performed packing

ProcessException: ProcessException: Bad CPU type in executable
  Command: /fluttersdk/flutter/bin/cache/artifacts/engine/android-arm-release/darwin-x64/gen_snapshot --causal_async_stacks --deterministic --print-snapshot-sizes --snapshot_kind=app-aot-blobs --vm_snapshot_data=build/app/intermediates/flutter/release/vm_snapshot_data --isolate_snapshot_data=build/app/intermediates/flutter/release/isolate_snapshot_data --vm_snapshot_instructions=build/app/intermediates/flutter/release/vm_snapshot_instr --isolate_snapshot_instructions=build/app/intermediates/flutter/release/isolate_snapshot_instr --no-sim-use-hardfp --no-use-integer-division build/app/intermediates/flutter/release/app.dill
Copy the code

Query issue(@alexayub using flutter on macOS Catalina is supported on v1.9.1 (the latest stable release) and later. More The details here github.com/flutter/flu… I learned that old Flutter (1.5.4) does not support the new version of The MAC system yet. You are directly required to upgrade. I have not found any compatible solution. Friends who don’t want to upgrade at the moment don’t owe.

The attached

✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.2 19C57, ✓ Locale zh-hans-cn) [✓] Android toolchain-developforAndroid Devices (Android SDK Version 29.0.2) [!]  Xcode - developforIOS and macOS (Xcode 11.3) Qualify CocoaPods installed but not working. You appear to have CocoaPods installed but it is not working. This can happenifthe version of Ruby that CocoaPods was installed with is different from the one being used to invoke it. This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293. To re-install CocoaPods, run: Sudo gem install Cocoapods [✓] Android Studio (version 3.5) [! Those who qualify onto university can apply to those who qualify. IntelliJ IDEA Ultimate Edition (Version 2019.1) Those who qualify onto university can apply to those who qualify. Those who qualify Dart plugin not installed; This adds Flutter specific functionality. this adds Dart specific functionality. [!]  Connected device ! No devices available ! Doctor found issuesin 3 categories.

Copy the code