Skip to main content
All CollectionsKnowledge BaseGeneral issues
Unable to sign jar due to invalid LOC header
Unable to sign jar due to invalid LOC header
Updated over 4 months ago

Issue:

When using the Android Sign Step, you receive the following error message:

Failed to sign Build Artifact, error: [jarsigner: unable to sign jar: java.util.zip.ZipException: invalid LOC header (bad signature)

Possible solutions:

You may be experiencing a JDK bug. You can try signing during your build phase instead of using the Android Sign Step:

1. Set up the following configuration in your in build.gradlefile:

    signingConfigs {
        release {
            keyAlias System.getenv("BITRISEIO_ANDROID_KEYSTORE_ALIAS")
            keyPassword System.getenv("BITRISEIO_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD")
            storeFile file(System.getenv("HOME") + "/keystores/my_keystore.jks")
            storePassword System.getenv("BITRISEIO_ANDROID_KEYSTORE_PASSWORD")
        }
    }

2. Add the File Downloader Step to download your keystore file before your build Step. Here is an example bitrise.yml:

   - [email protected]:
        inputs:
        - destination: "$HOME/keystores/my_keystore.jks"
        - source: "$BITRISEIO_ANDROID_KEYSTORE_URL"
    - [email protected]:
        inputs:
        - gradle_file: "$GRADLE_BUILD_FILE_PATH"
        - gradle_task: assembleRelease
        - gradlew_path: "$GRADLEW_PATH"

Additional information:

Did this answer your question?