Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
.PHONY: run
# certs and output
# or, if you're using Crosswalk:
# UNSIGNED=platforms/android/build/outputs/apk/android-armv7-release-unsigned.apk
# create a signed apk
rm -f ${OUTPUT_FILE}
cordova build android --release
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore ${KEYSTORE} -storepass ${KEYPASS} ${UNSIGNED} ${ALIAS}
zipalign -v 4 ${UNSIGNED} ${OUTPUT_FILE}
adb shell am start -n ${PACKAGE}/${PACKAGE}.MainActivity
# install a signed apk on a device
adb install -r ${OUTPUT_FILE}
# monitor logs and filter by package name
adb logcat | grep `adb shell ps | grep ${PACKAGE} | cut -c10-15`
run: sign install execute log

This comment has been minimized.

Copy link

@swoleengineer swoleengineer commented May 13, 2017



This comment has been minimized.

Copy link

@swoleengineer swoleengineer commented May 15, 2017

Hey, I keep getting an error with this..

  • Looked up everywhere and can't find how to fix. Even tried modifying the variables to the full directories of each file, both with forward and back slashes.
  • Moved files around and tried doing it again.
  • Nothing
    process_begin: CreateProcess(NULL, rm -f InAppPurchases.apk, ...) failed
    make (e=2): The system cannot find the file specified.
    make: *** [sign] Error 2

EDIT: Nevermind... it just doesn't work in CMD.. only works in Git Bash


This comment has been minimized.

Copy link

@verybluebot verybluebot commented Jul 13, 2019

thanks, very useful. Only one thing:
When you build a release the name of the file is app-release-unsigned.apk, NOT android-release-unsigned.apk

this took a few hours of my life..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.