Skip to content Skip to sidebar Skip to footer

How To Rebuild And Run Android Project From Command Line

I want create same process that android studio run in background through command line like first clean project -> build project -> Run Project all through command line (may

Solution 1:

You can execute all the build tasks available to your Android project using the Gradle wrapper command line tool. It's available as a batch file for Windows (gradlew.bat) and a shell script for Linux and Mac (gradlew.sh), and it's accessible from the root of each project you create with Android Studio.

You want same as Shift+F10 so use gradlew installDebug instead gradlew assembleDebug. It will build and install apk in connected adb device.

Thank and refer Build Your App from the Command Line for more help.

Thanks to above link!

Solution 2:

You can execute the commands from the root of your android project.

For cleaning the project, run ./gradlew clean. After cleaning, for building the project, run ./gradlew build.

For installation, run ./gradlew installDebug.

Also you can merge these steps in a single line as follows: ./gradlew clean build installDebug.

Post a Comment for "How To Rebuild And Run Android Project From Command Line"