Hi
At my work, we have one build server that has keys/certificates for the Android and iOS store.
I only have Unity installed on my machine, not on that server.
Is there a way to build a APK that I can sign on that build server, without having to install Unity on that server?
you can export android project, and then build/sign with gradle
I have a simple script for signing .apk’s. You can build your APK unsigned and then resign it using this script. Unity is not needed (only the JDK).
Note that this is hardcoded to use paths from my machine. it can be very easily be replaced with environment variables or another mechanism for adjusting it to your build machine.
Also, note that i am using JDK 1.6. Thi is due to an issue we’ve seen where APKs that are resigned with newer JDK cannot be installed on certain devices. You can google it to find out some more info about it.
# usage: ./resign_apk.sh <path to apk>
# NOTE: remove do not include the .apk extension, only the file name
# remote META-INF
zip -d "$1.apk" META-INF/\*
# resign
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/jarsigner -verbose -keystore /path/to/keystore -signedjar "$1_unaligned.apk" "$1.apk" keystore_alias
# verify apk
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/jarsigner -verbose -certs -verify "$1_unaligned.apk" -keystore /path/to/keystore
# align the APK
/Users/Shared/Android/sdk/build-tools/23.0.1/zipalign -v 4 "$1_unaligned.apk" "$1_signed.apk"
# delete the unaligned apk
rm -rf "$1_unaligned.apk"
Cool! Thanks a lot, this will (probably) save me 