简体   繁体   中英

Generated apk is unsigned after gradle plugin update

So, my project was doing fine until I updated android gradle plugin to version 3.6. Now, when I generate release apk via "Generate signed APK" in Android Studio, or build a release apk on our CI, it generates an apk that is unsigned. I use jre's "jarsigner" tool to verify it (jarsigner --verify --certs D:\\app-release.apk) and it tells me that "jar is unsigned". I have a signing config in my build.gradle:

signingConfigs {
    release {
        storeFile file(signing.keyPathRetail)
        storePassword signing.storePasswordRetail
        keyAlias signing.keyAliasRetail
        keyPassword signing.keyPasswordRetail
    }
}

The keystore's location and all passwords are correct. The keystore itself wasn't changed in years. The same exact project is generating a valid signed apk when I revert the com.android.tools.build:gradle dependency back to version 3.4.2.

I've found out that if I open the generated apk in 7-zip, it is missing files "CERT.RSA" and "CERT.SF" in the META-INF folder (the apk generated with 3.4.2 gradle plugin version has them), but I don't have any idea why.

Just straightaway go : Build - Generate Signed APK - Select the keystore and key, and you are on your way.

It worked for me.

Try following the steps:-

In Android Studio goto File > Project Structure and untick from "use embedded JDK" then click OK

Goto Computer Settings (system settings) (win + pause key) then go to Advanced system settings>Environment variables. if JAVA_HOME not present then add it and set path to your installed JDK. If you can't find a direct approach to modify JDK path, do the following(for the last step) BUT MAKE SURE YOU MAKE BACKUP BEFORE THIS.

To make sure where you are guiding come to project view, delete".grade", ".idea", "capture", "gradle" folders from the root and "build", "release", "lib" folder from "app" leaving "src" as it is. Delete root.iml and don't delete app.iml file Then rebuild the project and then create the Signed package

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM