r0adkll / sign-android-release

A GitHub action to sign an APK or AAB
MIT License
362 stars 137 forks source link

Unable to sign the APK #31

Closed omeryounus closed 4 years ago

omeryounus commented 4 years ago

I am getting the following error when signing the APK.

Run r0adkll/sign-android-release@v1 with: releaseDirectory: app/release signingKeyBase64: alias: keyStorePassword: keyPassword: env: JAVA_HOME_8.0.275_x64: /opt/hostedtoolcache/jdk/8.0.275/x64 JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.275/x64 JAVA_HOME_8_0_275_X64: /opt/hostedtoolcache/jdk/8.0.275/x64 BUILD_TOOLS_VERSION: 30.0.2 Preparing to sign key @ app/release with signing key /opt/hostedtoolcache/jdk/8.0.275/x64/bin/jarsigner -keystore app/release/signingKey.jks -storepass ** -keypass app/release/app-release.aab *** jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 38206 but got 38984 bytes)** Error: The process '/opt/hostedtoolcache/jdk/8.0.275/x64/bin/jarsigner' failed with exit code 1

omeryounus commented 4 years ago

I noticed when I place the .APK file then it works fine.

r0adkll commented 4 years ago

yah, it uses 2 different signing tools based on whether you are signing a .aab or a .apk. This looks to be a problem with the jarsigner utility that is used to sign app bundles. Let me look into this to see what might be going on.

trying running your workflow with this action pointed at the fix/bundle-signing branch. i.e.

uses: r0adkll/sign-android-release@fix/bundle-signing
harshmittal2810 commented 4 years ago

This is still falling when using this for bundle.

jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 97517 but got 99407 bytes) Error: The process '/opt/hostedtoolcache/jdk/8.0.275/x64/bin/jarsigner' failed with exit code 1

omeryounus commented 4 years ago

This is fixed by placing un signed APK file. If there is already a signed version of APK or AAB then it will be failed. However, error message still is not very clear.

omeryounus commented 4 years ago

Closing...

Onibenjo commented 3 years ago

This still fails for bundleRelease

Onibenjo commented 3 years ago

it worked

mindaugasnakrosis commented 3 years ago

@omeryounus could you elaborate how to solve this problem in CI/CD environment? Not sure what "placing un signed APK file" means.

@Onibenjo how did you solve this issue?

Onibenjo commented 3 years ago

Your apk must have been signed with some keystone details

In the signingConfigs section, the release object shouldn't have any signing details

mindaugasnakrosis commented 3 years ago

Thanks for the quick response @Onibenjo

In the signingConfig section I removed:

storeFile file('your_key_name.keystore')

Line and the rest what was left is now:

 release {
    storePassword 'XXX'
    keyAlias 'XXX'
    keyPassword 'XXX'
}

But now on the build I get an error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release
Onibenjo commented 3 years ago

Have you tried removing everything in the release section (leaving it blank)?

Onibenjo commented 3 years ago

And also check the release under signingConfigs and under buildTypes

mindaugasnakrosis commented 3 years ago

If I remove everyting in the release section I get the following error while building:

Build file '/home/runner/work/WMS-Android-App/WMS-Android-App/android/app/build.gradle' line: 169

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'release' for SigningConfig container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer.

Under buildtypes I have the following:

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
chrisedington commented 2 years ago

https://github.com/r0adkll/sign-android-release/issues/39#issuecomment-847981870