Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between clean, gradlew clean

What is the difference between the following statements when issued from a Android Studio Project's terminal :

Android_Studio_Project_Path: ./gradlew clean

Android_Studio_Project_Path: ./gradlew clean assembleDebug

Android_Studio_Project_Path: ./gradlew clean :assembleDebug

and normal Android Studio --> Build --> Clean.

What would be the difference in the internal process.

like image 660
prago Avatar asked Nov 30 '15 18:11

prago


People also ask

What does gradlew clean do?

it removes build folder, as well configure your modules and then build your project. i use it before release any new app on playstore.

What is gradlew assemble?

Assemble is a lifecycle task with no actions attached. Lifecycle tasks often combine other tasks and are useful to run in your development workflow. The purpose of assemble is to combine all tasks which produce a distribution or artifact into a single task.

How do I run the clean command in gradlew?

To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this: On Windows: gradlew <task1> <task2> … ​ e.g. gradlew clean allTests.


1 Answers

  1. ./gradlew clean

    Uses your project's gradle wrapper to execute your project's clean task. Usually, this just means the deletion of the build directory.

  2. ./gradlew clean assembleDebug

    Again, uses your project's gradle wrapper to execute the clean and assembleDebug tasks, respectively. So, it will clean first, then execute assembleDebug, after any non-up-to-date dependent tasks.

  3. ./gradlew clean :assembleDebug

    Is essentially the same as #2. The colon represents the task path. Task paths are essential in gradle multi-project's, not so much in this context. It means run the root project's assembleDebug task. Here, the root project is the only project.

  4. Android Studio --> Build --> Clean

    Is essentially the same as ./gradlew clean. See here.

For more info, I suggest taking the time to read through the Android docs, especially this one.

like image 93
kevinmm Avatar answered Oct 06 '22 21:10

kevinmm