Search code examples
androidvisual-studio-app-center

How to sign Android release build using uploaded release keystore on AppCenter?


My question is regarding this document, Android Code Signing Setup in App Center.

For some reason, my company prefers to not have release.keystore under version control. So, I want to use Upload everything to App Center. Unfortunately, they didn't provide any sample code I follow like what they did for Storing Signing Details in the Repository with Environment Variables.

So, I am wondering has anyone have the experience of that? I uploaded my release.keystore into AppCenter, I added the Store pass, Key Alias, and Key pass. I don't know how to reference it then in my build config file. Should I reference it? If yes, how? If no, then what might be the issue?

Currently, my build file looks like this:

android {
    ....

    signingConfigs {
        debug {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storePassword 'android'
            storeFile file('../keystore/debug.keystore')
        }

        release {

        }
    }
....
}

And this is the error I got on AppCenter:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

This is how I configured on AppCenter:

enter image description here


Solution

  • I finally figured it out:

    1. Delete release block from signingConfigs under the app/build.gradle file.
    2. Delete signingConfig signingConfigs.release from the buildTypes.release.

    Note: Step 2 is required if you want to keep lines under the release block.