There Is No Difference In Android Studio 2.3.3 Between Clean And Rebuild, So Why Have Both Options In Build Menu?
Solution 1:
I use clean to update R values while I'm in the middle of coding. I don't want to know that there are errors in my unfinished code, I just want the R file links to be current.
On the other hand Rebuild lists out all the errors.
So behind the scenes they may be the same, but the results are presented in different ways to the user.
Solution 2:
@Sam is correct. Looking ONLY at the Event log
is pretty superficial since it
only logs events, not details. Looking at the Gradle console
clarifies it all:
Here's what Clean
, even with an error in the code I'm compiling:
Executing tasks:
[clean, :app:generateDebugSources, :app:mockableAndroidJar,
:app:prepareDebugUnitTestDependencies,
:app:generateDebugAndroidTestSources,
:app:compileDebugSources, :app:compileDebugUnitTestSources,
:app:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:clean:app:clean:app: preBuild UP-TO-DATE
(MY NOTE ^^^^^^^^
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library:app:prepareComAndroidSupportAppcompatV72600Alpha1Library:app:prepareComAndroidSupportConstraintConstraintLayout102Library:app:prepareComAndroidSupportSupportCompat2600Alpha1Library:app:prepareComAndroidSupportSupportCoreUi2600Alpha1Library:app:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library:app:prepareComAndroidSupportSupportFragment2600Alpha1Library:app:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library:app:prepareComAndroidSupportSupportV42600Alpha1Library:app:prepareComAndroidSupportSupportVectorDrawable2600Alpha1Library:app:prepareDebugDependencies:app:compileDebugAidl:app:compileDebugRenderscript:app:generateDebugBuildConfig:app:generateDebugResValues:app:generateDebugResources:app:mergeDebugResources:app:processDebugManifest:app:processDebugResources:app:generateDebugSources:app:mockableAndroidJar:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportTestEspressoEspressoCore222Library:app:prepareComAndroidSupportTestEspressoEspressoIdlingResource222Library:app:prepareComAndroidSupportTestExposedInstrumentationApiPublish05Library:app:prepareComAndroidSupportTestRules05Library:app:prepareComAndroidSupportTestRunner05Library:app:prepareDebugAndroidTestDependencies:app:compileDebugAndroidTestAidl:app:processDebugAndroidTestManifest:app:compileDebugAndroidTestRenderscript:app:generateDebugAndroidTestBuildConfig:app:generateDebugAndroidTestResValues:app:generateDebugAndroidTestResources:app:mergeDebugAndroidTestResources:app:processDebugAndroidTestResources:app:generateDebugAndroidTestSources
Rebuild
does all that PLUS THE FOLLOWING IF there's an error in the code:
:app:incrementalDebugJavaCompilationSafeguard
:app:javaPreCompileDebug
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - isnot incremental (e.g. outputs have changed, no previous execution, etc.).
C:\Users\Dov\Desktop\SQhell\app\src\main\java\com\dslomer64\sqhell\MainActivity.java:221: error: not a statement
x returntrue;
^
C:\Users\Dov\Desktop\SQhell\app\src\main\java\com\dslomer64\sqhell\MainActivity.java:221: error: ';' expected
x returntrue;
^
2 errors
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace optiontoget the stack trace. Run with --info or --debug optiontoget more log output.
BUILD FAILED
Total time: 16.398 secs
If there is NO error in the code, Rebuild
does this:
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources:app:incrementalDebugUnitTestJavaCompilationSafeguard UP-TO-DATE
:app:javaPreCompileDebugUnitTest:app:compileDebugUnitTestJavaWithJavac UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:processDebugUnitTestJavaRes UP-TO-DATE
:app:compileDebugUnitTestSources UP-TO-DATE
:app:incrementalDebugAndroidTestJavaCompilationSafeguard:app:javaPreCompileDebugAndroidTest:app:compileDebugAndroidTestJavaWithJavac:app:compileDebugAndroidTestNdk UP-TO-DATE
:app:compileDebugAndroidTestSources
BUILD SUCCESSFUL
Total time:26.83 secs
In any event, Build
performs a Clean
AND THEN COMPILES the code, terminating if errors are found (and listed); otherwise, doing a full compile.
So Clean
DOES differ from Rebuild
.
(This means some other posts, like the one listed in Question, have to be modified.)
Post a Comment for "There Is No Difference In Android Studio 2.3.3 Between Clean And Rebuild, So Why Have Both Options In Build Menu?"