Difference between clean, gradlew clean

AndroidAndroid StudioGradleGradlew

Android Problem Overview


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.

Android Solutions


Solution 1 - Android

  1. ./gradlew clean

    Uses your project's [gradle wrapper][1] 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][2], 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][3].

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

[1]: https://docs.gradle.org/current/userguide/gradle_wrapper.html "gradle wrapper" [2]: https://docs.gradle.org/current/userguide/multi_project_builds.html "multi-project" [3]: https://stackoverflow.com/questions/28581211/how-to-project-clean-in-android-studio [4]: http://developer.android.com/tools/building/plugin-for-gradle.html "this one"

Solution 2 - Android

You should use this one too:

./gradlew :app:dependencies (Mac and Linux) -With ./

gradlew :app:dependencies (Windows) -Without ./

The libs you are using internally using any other versions of google play service.If yes then remove or update those libs.

Solution 3 - Android

You can also use

./gradlew clean build (Mac and Linux) -With ./

gradlew clean build (Windows) -Without ./

it removes build folder, as well configure your modules and then build your project.

i use it before release any new app on playstore.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpragoView Question on Stackoverflow
Solution 1 - AndroidkevinmmView Answer on Stackoverflow
Solution 2 - AndroidCristoferView Answer on Stackoverflow
Solution 3 - AndroidAbhishek GargView Answer on Stackoverflow