androidbuild.gradlereleaseandroid-app-bundle

Flutter - Receiving error when using command "flutter build appbundle" - A failure occurred while executing com.android.build.gradle.internal.tasks


I've followed all steps in this documentation: https://docs.flutter.dev/deployment/android#signing-the-app

When using command: flutter build appbundle

I'm receiving this error:

FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:signReleaseBundle'. A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable java.lang.NullPointerException (no error message)


I previously tried to publish an app bundle to the Google Play Store but received a message that my SHA-1 key was incorrect. To fix this, I've clicked on "Change app signing key".

Now it says: "Google will generate and protect an app signing key for your releases". I'm not sure if this is why I'm receiving this error now. More details can be given if needed, thank you for any help!


Solution

  • Solved my problem, in app -> build.gradle file -> signingConfigs

    I was declaring the key properties inside the signingConfigs when all you you have to do is copy + paste the actual code as it is shown in the documentation.

    signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
    }
    

    It is only in the key.properties file that you need to enter your keystore properties.