[SOLVED] React Native: How to store android keystore file and its password securely in CircleCI

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under
CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.


I am working on integrating circleCI in our react native project. I started with the first workflow which is android build, which requires the keystore file and it’s alias and passwords, to achieve this task, I’ve used openssl to encrypt/decrypt the keystore file and store file’s passwords to the circleCI env variables (and for my local environment I’m using react-native-config).

This is my build.gradle file:

  signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
         release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword project.env.get('MYAPP_UPLOAD_STORE_PASSWORD')
                keyAlias project.env.get('MYAPP_UPLOAD_KEY_ALIAS')
                keyPassword project.env.get('MYAPP_UPLOAD_KEY_PASSWORD')

MYAPP_UPLOAD_STORE_FILE stored in the gradle.properties and the rest in env vars

I’ve git this error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > SigningConfig "release" is missing required property "storePassword".

A quick note: I can generate a release APK on my device

Is there any other approach to do this tedious task. Thanks in advance


I found a good resource which is in the CircleCI Docs itself: deploy-android-applications

Answered By – Hamza Hmem

people found this article helpful. What about you?