Compile and sign your Android app by command line

Unofficial Content

If you can use the GeneXus IDE in order to compile and sign, use it, it's the easiest way to do it. Take a look at HowTo: Publishing an application in Google Play.

If for some reason you can't, follow these steps:

1) Build your app with GeneXus (do a Rebuild All).

That makes your app be compiled and signed here: <KB Directory>\<Environment Directory>\mobile\Android\<Main Object Name>\bin\<Main Object Name>.apk
is the one that does it.

2) Add to the path environment variable <GeneXus Installation Directory>\Tools\ApacheAnt\bin (for Ant.bat) and <Java JDK bin> directory (for Jarsigner.bat)

3) Save <KB Directory>\<Environment Directory>\mobile\Android\<Main Object Name>\BuildRelease.Bat as your MyBuildRelease.bat and change the content as follows:

call ant release
call jarsigner -verbose -keystore <your keystore filename with full path> -storepass <your store password > -keypass <your key password> bin/<Main Object name>-unsigned.apk alias_name
<Android SDK Directory>\tools\zipalign -v 4 "<KB Directory>\<Environment Directory>\mobile\Android\<Main Object Name>\bin\<Main Object Name>-unsigned.apk"  "<KB Directory>\<Environment Directory>\mobile\Android\<Main Object Name>\bin\<Main Object Name>.apk" 

4) Take a look at <KB Directory>\<Environment Directory>\mobile\Android\<Main Object Name>AndroidManifest.xml to see if VersionCode and VersionName are OK and if  Android Application Permissions are OK.

5) Run MyBuildRelease.bat and get your apk: <KB Directory>\<Environment Directory>\mobile\Android\<Main Object Name>\bin\<Main Object Name>.apk