skip to Main Content

I have already tried using the –null-safety mode but than my app doesn’t work.
When I use the debug mode on the emuletor I have no problems.
Any idea?

Here the error message.

flutter build apk 

 Building with sound null safety 

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

 - package:plugin_platform_interface

For solutions, see https://dart.dev/go/unsound-null-safety


FAILURE: Build failed with an exception.

* Where:
Script 'C:srcflutterpackagesflutter_toolsgradleflutter.gradle' line: 1070

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command 'C:srcflutterbinflutter.bat'' finished with non-zero exit value 1 

* 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
Running Gradle task 'assembleRelease'...                           33,0s
Gradle task assembleRelease failed with exit code 1

Here my pubspec.yaml

name: name
description: desc

publish_to: 'none' 

version: 1.0.16

environment:
  sdk: ">=2.15.1 <3.0.0"
   
dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.5
  particles_flutter: ^0.1.4  
  sqflite: ^2.0.2
  intl: ^0.18.0
  flutter_staggered_grid_view: ^0.6.2
  flex_color_picker: ^2.5.0
  shared_preferences: ^2.0.15
  # image_picker_form_field: ^0.0.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^1.0.4

 

I try to update all the dependencies but still don’t work.

2

Answers


  1. Seems some dependencies not supporting null-safety and to solve this you can upgrade your dependencies

    To upgrade packages upto date

    Run
    flutter pub outdated --mode=null-safety to print all outdated packages.,

    And flutter pub upgrade --null-safety to upgrade all packages automatically

    Or use below command to run your application without null-safety.

    flutter run --no-sound-null-safety
    

    Better to keep working git branch before update

    Login or Signup to reply.
  2. I also facing release apk issue. I tried to change in the gradle.properties.

    org.gradle.jvmargs=-Xmx1536M
    android.useAndroidX=true
    android.enableJetifier=false <---- make it false.
    

    Then run flutter build apk command

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search