Unable to generate signed build using Android Studio

1.1k Views Asked by At

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

com.android.ide.common.signing.KeytoolException: Failed to read key keycsr from store "C:...\app\csrkeystore.jks": Invalid keystore format

I have put my .jks file in app module and added signing config as:

signingConfigs {
            release {
                keyAlias 'keycsr'
                keyPassword '********'
                storeFile file('csrkeystore.jks')
                storePassword '********'
            }
    }

Any help is appreciated.

1

There are 1 best solutions below

0
Robert On

Gradle Android tools expect your signing key to be saved in a Java Keystore File - aka JKS format.

The error mesage Invalid keystore format indicates that the file csrkeystore.jks is not a valid Java Keystore file.

There are a large number of similar formats like PKCS#12, BouncyCastev1, .. that all allow to store private keys, but they are not accepted here.

My recommendation is to download the Java open source tool KeyStore Explorer and open the file csrkeystore.jks. It will automatically detect the used file format for a large list of supported key store file types.

Once the file has been loaded you can execute Tools -> Change KeyStore type -> JKS and then save the jks file.

Afterwards it should be possible for Gradle Android tools to read your private signing key.