Error while signing android bundle: Execution failed for task ':app:signReleaseBundle'

Viewed 1662

I was trying to build a release build of Flutter android app and got following error: (Macbook M1 using terminal command)

* What went wrong:                                                      
Execution failed for task ':app:signReleaseBundle'.                     
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > kotlin.KotlinNullPointerException (no error message)

I've no idea how to fix this issue. The android/app/build.gradle of relevant part looks like:

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

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:2.0.1'
}
2 Answers

I had almost the same problem:

* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
   > kotlin.KotlinNullPointerException (no error message)

In my case, there was a typo in my key.properties file. I had keyPasswork instead of keyPassword and now everything is working fine. I suggest OP checks this file, too.

In my case, the file build.gradle under android/app had a typo in it

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

Check if this is right. Sometimes, the typo could be that instead of writing storePassword, it's written storeP assword

Related