Generate App Bundle with --no-sound-null-safety Flutter

1,618

Solution 1

Run

flutter build apk --split-per-abi --no-sound-null-safety

Credit

Solution 2

Disable sound null safety using the --no-sound-null-safety flag to the dart or flutter command:

 dart --no-sound-null-safety run
 flutter build apk --split-per-abi --no-sound-null-safety

Alternatively, set the language version in the entrypoint — the file that contains main() function — to 2.9

// @dart=2.9
import 'src/my_app.dart';

main() {
  //...
}
Share:
1,618
mrgnhnt96
Author by

mrgnhnt96

I love Flutter!

Updated on December 28, 2022

Comments

  • mrgnhnt96
    mrgnhnt96 over 1 year

    I am trying to generate the App Bundle via Android studio (Build -> Generate Signed Bundle / APK), and I am running into an error when building a bundle.

    Error: Cannot run with sound null safety, because the following dependencies
    don't support null safety
    

    Is there a way that I can add the argument --no-sound-null-safety, similar to what you can do in the command line?