Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build .apk file from Windows command-line?

Tags:

android

apk

How can I build and signed (keystore) the .apk file using 'apkbuilder.bat' via windows command-line ?

I try to run the following line:

apkbuilder.bat %APK_File_Name% -u -z %Project_Path%\bin\resources.ap_ -f %Project_Path%\bin\classes.dex -rf %Project_Path%

but I'm getting the following exception:

java.lang.ArrayIndexOutOfBoundsException: 1
 at com.android.sdklib.build.ApkBuilderMain.main<ApkBuilderMain.java:61>

Please help. Thanks

like image 380
Frank Parsons Avatar asked Sep 30 '10 16:09

Frank Parsons


2 Answers

You can do it in command line (.bat) in windows using ant.

with: "ant release" You build the apk unsigned.

Then you need to add the call to "jarsigner" and "zipalign" in the bat to complete the task.

You can find an example of the command line to call these tools here: http://developer.android.com/guide/publishing/app-signing.html#signapp

Best,

like image 106
fpanizza Avatar answered Oct 14 '22 13:10

fpanizza


I would suggest using Ant and the build files generated by the Android tools rather than trying to handroll your own. If nothing else, you can use the build files as a reference to determine how it uses the various tools to perform each step.

like image 28
codelark Avatar answered Oct 14 '22 12:10

codelark