How to compile Android Studio project via command line

Android Studio IDE has become more buggy and shit, stuck on loading devices, invalid syntaxes even it still able to compile, random freezing, high CPU usages on idle, and many more. Maybe i’m dumb, but honestly it works like shit. Invalidate caches and full reinstall doesn’t help much. i’m tired of it, and gave up using it so I needed to find a way to compile via command line instead. Using Notepad++ and CMD is so much better for me. Today I will share my way to compile an Android Studio project via command line. I will use LGL menu as an example LGLTeam/Android-Mod-Menu

I will not explain the techinal details about how to set environment variable path, extracting zip, installation, etc, as the internet already covers. Just search how to do it

Correct me if i’m wrong, i’m not the best in Android development

Setup and Installation:
Assuming you have Android Studio, SDK and NDK installed. If not, please install them, gradle will not work without them

Additionally you can set the environment path as ANDROID_SDK to your SDK

IMPORTANT: Know the gradle version of the project, take a look on \gradle\wrapper\ for the version. This one is 6.7.1


Follow this site and download and install Gradle version that matches with the project. Set environment path to your [gradle location]/bin folder

Installing Gradle

Using mismatched Gradle versions may cause a lot of errors, I made a mistake using latest version of Gradle that didn’t match with 6.7.1. Please change the version in the if you want to use other versions than the project’s, and make sure the version match

If you haven’t set the environment path to your SDK, you can create or edit the file and set path to your SDK



Recommended that you already set the environment so you don’t need to change

Compiling the project:
Open CMD/Powershell/Terminal/ and CD to the project path, or launch the CMD/Powershell/Terminal directly from File explorer if your system supports it, so the path will be automatically changed to that


Build the project and output debug APK straight forward. Fix the errors if any.


gradle assembleDebug

APK will be outputted to \app\build\outputs\apk\release\app-release.apk

See more: Build your app from the command line | Android Developers

Compiling lib only:
This method doesn’t need gradle, only NDK needed

Create a file called compile.bat (Windows) or (Linux/macOS) to [Project]\app\src\main\


Add these, change NDK path to yours and save



Then just double click the batch/sh file to compile.

But this way you can’t see the errors as it closes instantly. It’s recommended you leave the CMD/Powershell/Terminal open with the path changed to [Project]\app\src\main\
So you can just type



You can see if it successful or not


Libs will be outputted to [Project]\app\src\main\libs


That’s pretty much all. You are now free of Buggy Studio


Popular Posts

VMOS Pro Global CN FREE Custom ROMs | Gapps, ROOT, Xposed | Android 4.4.4, 5.1.1, 7.1.2, 9.0 ROMs | NO VIP

How to activate VMOS Assistant to run VMOS on Android 12 and above