Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

generate signed .apk in jenkins with gradle

This is part of my jenkins job configuration: enter image description here

Build this job, and I get the .apk(s) here:

enter image description here

As you can see, all the .apk(s) are unsigned.

Now, How to sign one/all of these .apk files WITHOUT edit my build.gradle. I want to add a new task after the build, but I don't know where to configure my keystore and the generated apk path enter image description here

like image 921
Lim CHAN Avatar asked Jan 18 '26 02:01

Lim CHAN


2 Answers

Ahhhhhhh~ finally!! I solve my problem. (LOL....)

Here's the trick:

1. Add build step -> Execute shell:

enter image description here

2. edit command lines, format: jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore $KEYSTORE/JKS -storepass $PASSWORD -signedjar $SIGNED.APK $INPUT_UNSIGNED.APK $KEY_ALIAS enter image description here 3. Post-build Actions -> add post-build action:

enter image description here

4. edit app/build/outputs/apk/*-signed.apk

enter image description here

After the Build Now operation, you will see the target signed apk files: enter image description here

like image 54
Lim CHAN Avatar answered Jan 20 '26 15:01

Lim CHAN


You can also click the (?) icon next to each field to get help.

The plugin page also links to detailed usage documentation.

like image 40
Christopher Orr Avatar answered Jan 20 '26 17:01

Christopher Orr