Skip to main content

Building a release .apk package with SenchaCmd and Cordova

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· One min read
Stephan Hochdörfer
Head of IT Business Operations

Since it is not really documented how to build a release .apk package with SenchaCmd and Cordova I`d like to share the current workflow I use. First of all we build the native package via SenchaCmd. This results in a production build of the Sencha Touch application wrapped in a debug build of Cordova:

sencha app build native --clean

There seems to be no way to let SenchaCmd compile a .apk release build directly, it is needed to manually invoke Cordova:

cd cordova
cordova build android --release

As a next step the .apk release needs to be signed:

cd platforms/android/ant-build/
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./../../../../keys/android/release.keystore CordovaApp-release-unsigned.apk release

Last not least let's optimize the .apk package with the zipalign tool. It is crucial to perform zipalign after signing the .apk file, because the signing procedure will undo the alignment.

/opt/android-sdk/build-tools/21.1.2/zipalign -v 4 CordovaApp-release-unsigned.apk myapp.apk

The myapp.apk file can now be uploaded to the Google Play Developer Console.