0

I've followed the steps here: Flutter docs

This is the error I get when running flutter build appbundle (same with apk)

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)

This are the changes I made to build.gradle

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

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

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            minifyEnabled true
            shrinkResources true
            signingConfig signingConfigs.release
        }
    }
}

And this is my key.properties file

storePassword=passwordwhenusingkeytool
keyPassword=passwordwhenusingkeytool
keyAlias=upload
storeFile=/Users/leandro.nnz/public_html/mobile/activeloc/upload-keystore.jks

I can't get to build it. Searched internet but nothing woks, seems that something is wrong with keystore. I don't know what I'm missing.

Thanks in advance.

leandronn
  • 173
  • 1
  • 17
  • 1
    First, make sure the ```key.properties``` is in root folder and accessible (you can print it from gradle). Second, for the ```storeFile```, it should be ```file(keystoreProperties['storeFile'])``` – danypata Feb 24 '23 at 16:35

0 Answers0