question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load signer "signer #1" java.io.IOException: Invalid keystore format

See original GitHub issue

Hello, I’m trying to use this action to sign an apk, but I’m having an issue. I added the “ALIAS”, “KEY_PASSWORD”, “KEY_STORE_PASSWORD”, and “SIGNING_KEY” to the Secrets tab in the project. The “SIGNING_KEY” is the shaded part between -----BEGIN ENCRYPTED PRIVATE KEY----- and -----END ENCRYPTED PRIVATE KEY-----

Screenshot from 2019-11-18 16-22-48

I tried with BEGIN and END text, and got the same results.

Actual .yml file:

name: Android CI

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1

    - name: set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8

    - name: Grant rights
      run: chmod +x build.gradle

    - name: Build project with Gradle
      run: ./gradlew build

    - name: Build Debug APK with Gradle
      run: ./gradlew assembleDebug

    - name: Build Release APK with Gradle
      run: ./gradlew assembleRelease

    - name: Releasing Debug APK using Hub
      uses: ShaunLWM/action-release-debugapk@master
      env:
        GITHUB_TOKEN: ${{ secrets.TOKEN }}
        APP_FOLDER: app
        RELEASE_TITLE: BarberApp

    - name: Signing and Releasing Release APK using Hub
      uses: r0adkll/sign-android-release@v1
      with:
        releaseDirectory: ./app/build/outputs/apk/release
        signingKeyBase64: ${{ secrets.SIGNING_KEY }}
        alias: ${{ secrets.ALIAS }}
        keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
        keyPassword: ${{ secrets.KEY_PASSWORD }}

Log output showing the error:

/usr/local/lib/android/sdk/build-tools/29.0.2/apksigner sign --ks app/build/outputs/apk/release/signingKey.jks --ks-key-alias *** --ks-pass pass:*** --key-pass pass:*** --out app/build/outputs/apk/release/app-release-unsigned-signed.apk app/build/outputs/apk/release/app-release-unsigned-aligned.apk
Failed to load signer "signer #1"
java.io.IOException: Invalid keystore format
	at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:663)
	at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:56)
	at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:224)
	at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
	at java.security.KeyStore.load(KeyStore.java:1445)
	at com.android.apksigner.SignerParams.loadKeyStoreFromFile(SignerParams.java:353)
	at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:239)
	at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181)
	at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:277)
	at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:83)
##[error]The process '/usr/local/lib/android/sdk/build-tools/29.0.2/apksigner' failed with exit code 2
##[error]Node run failed with exit code 1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
me-at-syeds-mecommented, Feb 9, 2021

@r0adkll

I am still facing this issue including converting base64 of jks.

Verification succesful /bin/cp android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/app-release-aligned.apk /usr/local/lib/android/sdk/build-tools/30.0.2/apksigner sign --ks android/app/build/outputs/apk/release/signingKey.jks --ks-key-alias *** --ks-pass pass:*** --out android/app/build/outputs/apk/release/app-release-signed.apk --key-pass pass:*** android/app/build/outputs/apk/release/app-release-aligned.apk Failed to load signer “signer #1”: android/app/build/outputs/apk/release/signingKey.jks entry “***” does not contain a key Error: The process ‘/usr/local/lib/android/sdk/build-tools/30.0.2/apksigner’ failed with exit code 2

Any thoughts or guidance is super helpful. Have been stuck for two days on this issue. Thanks.

1reaction
r0adkllcommented, Nov 18, 2019

You will need to base64 encode the entire file as the action decodes it straight to the disk.

For example, I run this on my signing key: (I run this on macOS, so your implementation may differ)

openssl base64 < some_key.jks | tr -d '\n' | tee some_key.jks.base64.txt

Then I copy the contents of some_key.jks.base64.txt to my GitHub secret secrets.SIGNING_KEY

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - apksigner - Invalid keystore format - Stack Overflow
Create a new simple xamarin forms app. · Delete existing debug.keystore file from "C:\Users\YourUser\AppData\Local\Xamarin\Mono for Android".
Read more >
Android Question [SOLVED] Issue with Google Play App Signing
Keystore password for signer #1: Failed to load signer "signer #1" java.io.IOException: Invalid keystore format at sun.security.provider.
Read more >
Android APK Rejections / Upload Errors with Google Play ...
Keystore password for signer #1: Failed to load signer "signer #1". java.io.IOException: Invalid keystore format. at sun.security.provider.
Read more >
Invalid keystore format" when the Postinstallsetup fails in MDM
To resolve this issue, do as follows: 1. Stop the application server. 2. Backup and remove MDM_KEYSTORE_FILE_JKS.keystore file from ...
Read more >
Build issue using APKSigner - Game Makers Help - Construct 3
But when I try to use the apksigner I get;. 'Failed to load signer "signer #1"'. 'Java.io.IOException: invalid keystore format'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found