Invalid keystore format only in gradle

android

(Leo Loe) #1

I’m not entirely sure that this is bug in gradle, so let me please ask this question here first but feel free to move it if you wish.
I wanted to upload my keystore but unfortunately new users can’t do it … so I had to place it here: https://ufile.io/p86xa

Anyway the problem is that I can sign my android app with this keystore using Android Studio (Build -> Generate Signed APK), so this keystore is valid. However when I’ve added following code to my app/build.gradle:

signingConfigs {
    release {
        storeFile file('platform.keystore')
        keyAlias 'platform'
        storePassword 'testpass'
        keyPassword 'testpass'
    }
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        signingConfig signingConfigs.release
    }
}

and when I do:

./gradlew assembleRelease

I get:

Failed to read key platform from store "(...)/app/platform.keystore": Invalid keystore format

The alias and password are ok, there is no typo or something like that because as I said I’m able to sign the app from Android Studio with the same pass and alias.
I’m using gradle 4.5 but I don’t think this is relevant.


(Leo Loe) #2

I’ve found root cause with help from stackoverflow:

The problem was with keytool used for generating keys (not gradle), and it was because although my default java was 8, my default keytool was from java 10 … When I’ve switched to keytool from java 8 everything started to work fine.