I just tested yesterday the latest beta release from Flutter (1.11.0) and even if up until now I was so pleased with my Flutter experience ( 💙) I can say that I just ran into my first weird bug.

That’s me, yesterday…

I know that the best practice would be to stay and play with Flutter on the stable channel, but I just wanted to test the upcoming release, since rumors have it that it’s expected to be announced next week during the Flutter Interact event.

How do you test a beta version of Flutter?

Flutter is divided into four channels (i.e. versions): stable, beta, dev and master (ordered by stability).

You can easily see your current branch using the flutter channel command:

~|⇒ flutter channel Flutter channels:

* stable

dev

master

beta

Switching between branches is as simple as typing the following command:

flutter channel <yournewchannel> Eg: flutter channel beta

Reminder: don’t forget to run the flutter upgrade command afterward, which will resynchronize your local snapshot (since it may not be up-to-date).

So what’s the problem with Flutter beta?

All in all the release mode is working just fine: if you want to generate an IPA (iOS), an App Bundle or an APK (Android) from your Flutter application, there’s nothing significant that’s changed between the beta and the stable channel.

However, when I was building my test app (this time in debug mode) I stumbled upon this error I’ve never seen before:

Launching lib/main.dart on AOSP on IA Emulator in debug mode...

Running Gradle task 'assembleDebug'...



FAILURE: Build failed with an exception.



* What went wrong:

Could not determine the dependencies of task ':app:compileInternalDebugKotlin'.

> Could not resolve all files for configuration ':app:internalReleaseRuntimeClasspath'.

> Could not find io.flutter:x86_release:1.0.0-af04338413c3ed73316350f64248a152433073b6.

Searched in the following locations:

- https://dl.google.com/dl/android/maven2/io/flutter/x86_release/1.0.0-af04338413c3ed73316350f64248a152433073b6/x86_release-1.0.0-af04338413c3ed73316350f64248a152433073b6.pom

- https://dl.google.com/dl/android/maven2/io/flutter/x86_release/1.0.0-af04338413c3ed73316350f64248a152433073b6/x86_release-1.0.0-af04338413c3ed73316350f64248a152433073b6.jar

- https://jcenter.bintray.com/io/flutter/x86_release/1.0.0-af04338413c3ed73316350f64248a152433073b6/x86_release-1.0.0-af04338413c3ed73316350f64248a152433073b6.pom

- https://jcenter.bintray.com/io/flutter/x86_release/1.0.0-af04338413c3ed73316350f64248a152433073b6/x86_release-1.0.0-af04338413c3ed73316350f64248a152433073b6.jar

- http://download.flutter.io/io/flutter/x86_release/1.0.0-af04338413c3ed73316350f64248a152433073b6/x86_release-1.0.0-af04338413c3ed73316350f64248a152433073b6.pom

- http://download.flutter.io/io/flutter/x86_release/1.0.0-af04338413c3ed73316350f64248a152433073b6/x86_release-1.0.0-af04338413c3ed73316350f64248a152433073b6.jar

Required by:

project :app



* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.



* Get more help at https://help.gradle.org



BUILD FAILED in 31s

Finished with error: Gradle task assembleDebug failed with exit code 1

What? A missing dependency? But why is it working fine in release mode?

When I saw that this was about a missing x86 dependency, I’ve tried to run the app on an ARM processor instead (my phone)… and the error went away 🤨.

Actually, the problem is the emulator!

I didn’t notice it before, but all my AVDs (Android Virtual Devices = Android emulators) were using an x86 image. Switching to an x86_64 bits image solved my problem:

The list of your AVDs

So what did I learn here? Before migrating to the upcoming release of Flutter, please make sure all your Android emulators use an x86_64 bits image. Or else you’ll get stuck just like me!

Why did Google decide to make this change?

Up until now, you could debug your Flutter app on Android using an x86 image, but you couldn’t release for x86 and x86_64.

Quoting the FAQ:

Flutter currently does not support building for x86 Android (issue #9253) directly, however apps built for ARMv7 or ARM64 run fine (via ARM emulation) on many x86 Android devices.

The Flutter team seems to have changed their mind on this topic and, following this recent Pull Request, the framework now only supports debugging and releasing for the x86_64 architecture. That’s the reason why Google made this change and your x86 image stops working in the new release.

A warning message would have been welcomed since digging into the GitHub issues is quite time consuming.

Let’s hope they’ll have enough time to review it before the big 12.11 event!

Don’t forget to update your code!

The upcoming release will not only break your Android emulators, it will also trigger new warnings.

Among them, for reasons explained in this PR on GitHub, the Flutter team has decided to deprecate the method inheritFromWidgetOfExactType in the State class.

The flutter analyze command will now generate a warning:

info • 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead.

As suggested, you’ll have to change the method name and switch to the new one. Before :

InheritedWidget inheritFromWidgetOfExactType(Type targetType, { Object aspect }); Eg: context.inheritFromWidgetOfExactType(YourInheritedWidget)

After:

T dependOnInheritedWidgetOfExactType<T extends InheritedWidget>({ Object aspect }); Eg: context.dependOnInheritedWidgetOfExactType<YourInheritedWidget>()

You are now ready for the upcoming release of Flutter! 🥳