React Native Generating Signed APK "KeyStore file not set for signing config release"

Benjamin picture Benjamin · Jun 5, 2017 · Viewed 39.9k times · Source

I am trying to generate a signed APK. I have my password.keystore file located in \Dictionary\android\app and when i ran gradlew assembleRelease on cmd, the error:

Execution failed for task ':app:validateSigningRelease'.

Keystore file not set for signing config release

Where should I store my password.keystore file? Because when I commented off the if (project.hasProperty("password.keystore") { it seems to work but with the following error instead:

Unable to process incoming event 'ProgressComplete ' (ProgressCompleteEvent)

How should I write my if condition or where should I store the password.keystore file?

The source code is as follows:

signingConfigs {
  release {
    if (project.hasProperty("password.keystore")) {
      storeFile file("password.keystore")
      storePassword "password"
      keyAlias "username"
      keyPassword "password"
    }
  }
}

Answer

Yoruba picture Yoruba · Jul 18, 2017

The keystore file has to be in the android/app folder.

The message 'Keystore file not set for signing config release' has to do that there is no signingConfig in the android/app/build.gradle file.

buildTypes {
    release {
        // other settings
        signingConfig signingConfigs.release
    }
}

For testing you can just hard coded the settings in the android/app/build.gradle, instead off set it in the gradle.properties. This was fixing for me the problem with 'Keystore was tampered with, or password was incorrect'

  signingConfigs {
    release {
        //if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            storeFile file("key.keystore")
            storePassword "****"
            keyAlias "myKey"
            keyPassword "****"
       // }
    }
}