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)
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.gradle
file:
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:
- file-downloader@1.0.1:
inputs:
- destination: "$HOME/keystores/my_keystore.jks"
- source: "$BITRISEIO_ANDROID_KEYSTORE_URL"
- gradle-runner@1.8.3:
inputs:
- gradle_file: "$GRADLE_BUILD_FILE_PATH"
- gradle_task: assembleRelease
- gradlew_path: "$GRADLEW_PATH"