Home > database >  Flutter Release APK for playstore
Flutter Release APK for playstore

Time:02-10

I am trying to generate a build apk, but getting following error. this is compatible with flutter version 2.8.1

Getting following error while run flutter build apk


/home/dell/snap/flutter/common/flutter/bin/flutter --no-color build apk

Building without sound null safety For more information see enter image description here

CodePudding user response:

Please don't show confidential code like your package name, key.properties file kindly edit and remove those to protect your app from malicious itentions.

Since your flutter version is 2.8.1 but your dart sdk in pubspec.yaml is sdk: ">=2.7.0 <3.0.0" it requires to enable null-safety for your project just change the 2.7.0 to 2.12.0 or above, and also do require changes for flutter null safety for more details check out this https://dart.dev/null-safety/unsound-null-safety

You maybe getting this error as some of the packages you used in your project use null-safety so migrate your app to null-safety.

You can check this for more details about generating production apps https://docs.flutter.dev/deployment/android

you can also use this code to generate a obfuscated apk

flutter build apk --release --obfuscate --split-debug-info={directory}

similarly for appbundle:

flutter build appbundle --release --obfuscate --split-debug-info={directory}

CodePudding user response:

For release playstore build change

this in app/build.gradle

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }

to

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }

CodePudding user response:

Did you register your Application class in the Manifest file?

like this :

<application
        android:name=".Application"
        android:label="app_name"
        android:icon="@mipmap/ic_launcher"/>
  • Related