Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to build a .apk from the terminal?

I am developing a dynamic app generator, so I would need to run the command on a runtime basis using Java on a server

like image 932
Vijay Dhas Gilbert Avatar asked Dec 07 '22 17:12

Vijay Dhas Gilbert


2 Answers

From the Android Developer site:

Managing Projects from the Command Line

Building APK from Command Line

You will need Gradle to build from the command line. Once you have that you can create the APK like this:

Windows:

> gradlew.bat assembleRelease

Unix:

$ ./gradlew assembleRelease

This creates your Android application .apk file inside the project bin/ directory, named -unsigned.apk.

like image 165
SERPRO Avatar answered Feb 10 '23 14:02

SERPRO


If you may rely on Android SDK, it is as simple as to generate build.xml and some properties file and invoke ant.

You may generate an android project by command android for reference.

like image 23
pinxue Avatar answered Feb 10 '23 14:02

pinxue