问题
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.
回答1:
./gradlew cleanUses your project's gradle wrapper to execute your project's
cleantask. Usually, this just means the deletion of the build directory../gradlew clean assembleDebugAgain, uses your project's gradle wrapper to execute the
cleanandassembleDebugtasks, respectively. So, it will clean first, then executeassembleDebug, after any non-up-to-date dependent tasks../gradlew clean :assembleDebugIs 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.
Android Studio --> Build --> CleanIs 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.
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/34005713/difference-between-clean-gradlew-clean