加快gradle构建速度
给gradle加上daemon选项,让gradle常驻内存, 下一次再调用时就会重用内存中的gradle,而免去加载时的消耗,如
gradle assemble --daemon
第一次调用时输出如下(耗时8.662秒):
E:\code\android\ZeroWeiProject>gradlew assemble --daemon :ZeroWei:preBuild UP-TO-DATE :ZeroWei:preDebugBuild UP-TO-DATE :ZeroWei:preReleaseBuild UP-TO-DATE :slidingmenu:compileLint :slidingmenu:copyReleaseLint UP-TO-DATE :slidingmenu:mergeReleaseProguardFiles UP-TO-DATE :slidingmenu:packageReleaseAidl UP-TO-DATE :slidingmenu:preBuild UP-TO-DATE :slidingmenu:preReleaseBuild UP-TO-DATE :slidingmenu:prepareReleaseDependencies :slidingmenu:compileReleaseAidl UP-TO-DATE :slidingmenu:compileReleaseRenderscript UP-TO-DATE :slidingmenu:generateReleaseBuildConfig UP-TO-DATE :slidingmenu:mergeReleaseAssets UP-TO-DATE :slidingmenu:mergeReleaseResources UP-TO-DATE :slidingmenu:processReleaseManifest UP-TO-DATE :slidingmenu:processReleaseResources UP-TO-DATE :slidingmenu:generateReleaseSources UP-TO-DATE :slidingmenu:compileRelease UP-TO-DATE :slidingmenu:processReleaseJavaRes UP-TO-DATE :slidingmenu:packageReleaseJar UP-TO-DATE :slidingmenu:packageReleaseLocalJar UP-TO-DATE :slidingmenu:packageReleaseRenderscript UP-TO-DATE :slidingmenu:packageReleaseResources UP-TO-DATE :slidingmenu:bundleRelease UP-TO-DATE :ZeroWei:prepareZeroWeiProjectSlidingmenuUnspecifiedLibrary UP-TO-DATE :ZeroWei:prepareDebugDependencies :ZeroWei:compileDebugAidl UP-TO-DATE :ZeroWei:compileDebugRenderscript UP-TO-DATE :ZeroWei:generateDebugBuildConfig UP-TO-DATE :ZeroWei:mergeDebugAssets UP-TO-DATE :ZeroWei:mergeDebugResources UP-TO-DATE :ZeroWei:processDebugManifest UP-TO-DATE :ZeroWei:processDebugResources UP-TO-DATE :ZeroWei:generateDebugSources UP-TO-DATE :ZeroWei:compileDebug UP-TO-DATE :ZeroWei:dexDebug UP-TO-DATE :ZeroWei:processDebugJavaRes UP-TO-DATE :ZeroWei:validateDebugSigning :ZeroWei:packageDebug UP-TO-DATE :ZeroWei:assembleDebug UP-TO-DATE :ZeroWei:prepareReleaseDependencies :ZeroWei:compileReleaseAidl UP-TO-DATE :ZeroWei:compileReleaseRenderscript UP-TO-DATE :ZeroWei:generateReleaseBuildConfig UP-TO-DATE :ZeroWei:mergeReleaseAssets UP-TO-DATE :ZeroWei:mergeReleaseResources UP-TO-DATE :ZeroWei:processReleaseManifest UP-TO-DATE :ZeroWei:processReleaseResources UP-TO-DATE :ZeroWei:generateReleaseSources UP-TO-DATE :ZeroWei:compileRelease UP-TO-DATE :ZeroWei:dexRelease UP-TO-DATE :ZeroWei:processReleaseJavaRes UP-TO-DATE :ZeroWei:packageRelease UP-TO-DATE :ZeroWei:assembleRelease UP-TO-DATE :ZeroWei:assemble UP-TO-DATE :slidingmenu:copyDebugLint UP-TO-DATE :slidingmenu:mergeDebugProguardFiles UP-TO-DATE :slidingmenu:packageDebugAidl UP-TO-DATE :slidingmenu:preDebugBuild UP-TO-DATE :slidingmenu:prepareDebugDependencies :slidingmenu:compileDebugAidl UP-TO-DATE :slidingmenu:compileDebugRenderscript UP-TO-DATE :slidingmenu:generateDebugBuildConfig UP-TO-DATE :slidingmenu:mergeDebugAssets UP-TO-DATE :slidingmenu:mergeDebugResources UP-TO-DATE :slidingmenu:processDebugManifest UP-TO-DATE :slidingmenu:processDebugResources UP-TO-DATE :slidingmenu:generateDebugSources UP-TO-DATE :slidingmenu:compileDebug UP-TO-DATE :slidingmenu:processDebugJavaRes UP-TO-DATE :slidingmenu:packageDebugJar UP-TO-DATE :slidingmenu:packageDebugLocalJar UP-TO-DATE :slidingmenu:packageDebugRenderscript UP-TO-DATE :slidingmenu:packageDebugResources UP-TO-DATE :slidingmenu:bundleDebug UP-TO-DATE :slidingmenu:assembleDebug UP-TO-DATE :slidingmenu:assembleRelease UP-TO-DATE :slidingmenu:assemble UP-TO-DATE BUILD SUCCESSFUL Total time: 8.662 secs
而第二次调用时(耗时3.599秒):
E:\code\android\ZeroWeiProject>gradlew assemble --daemon :ZeroWei:preBuild UP-TO-DATE :ZeroWei:preDebugBuild UP-TO-DATE :ZeroWei:preReleaseBuild UP-TO-DATE :slidingmenu:compileLint :slidingmenu:copyReleaseLint UP-TO-DATE :slidingmenu:mergeReleaseProguardFiles UP-TO-DATE :slidingmenu:packageReleaseAidl UP-TO-DATE :slidingmenu:preBuild UP-TO-DATE :slidingmenu:preReleaseBuild UP-TO-DATE :slidingmenu:prepareReleaseDependencies :slidingmenu:compileReleaseAidl UP-TO-DATE :slidingmenu:compileReleaseRenderscript UP-TO-DATE :slidingmenu:generateReleaseBuildConfig UP-TO-DATE :slidingmenu:mergeReleaseAssets UP-TO-DATE :slidingmenu:mergeReleaseResources UP-TO-DATE :slidingmenu:processReleaseManifest UP-TO-DATE :slidingmenu:processReleaseResources UP-TO-DATE :slidingmenu:generateReleaseSources UP-TO-DATE :slidingmenu:compileRelease UP-TO-DATE :slidingmenu:processReleaseJavaRes UP-TO-DATE :slidingmenu:packageReleaseJar UP-TO-DATE :slidingmenu:packageReleaseLocalJar UP-TO-DATE :slidingmenu:packageReleaseRenderscript UP-TO-DATE :slidingmenu:packageReleaseResources UP-TO-DATE :slidingmenu:bundleRelease UP-TO-DATE :ZeroWei:prepareZeroWeiProjectSlidingmenuUnspecifiedLibrary UP-TO-DATE :ZeroWei:prepareDebugDependencies :ZeroWei:compileDebugAidl UP-TO-DATE :ZeroWei:compileDebugRenderscript UP-TO-DATE :ZeroWei:generateDebugBuildConfig UP-TO-DATE :ZeroWei:mergeDebugAssets UP-TO-DATE :ZeroWei:mergeDebugResources UP-TO-DATE :ZeroWei:processDebugManifest UP-TO-DATE :ZeroWei:processDebugResources UP-TO-DATE :ZeroWei:generateDebugSources UP-TO-DATE :ZeroWei:compileDebug UP-TO-DATE :ZeroWei:dexDebug UP-TO-DATE :ZeroWei:processDebugJavaRes UP-TO-DATE :ZeroWei:validateDebugSigning :ZeroWei:packageDebug UP-TO-DATE :ZeroWei:assembleDebug UP-TO-DATE :ZeroWei:prepareReleaseDependencies :ZeroWei:compileReleaseAidl UP-TO-DATE :ZeroWei:compileReleaseRenderscript UP-TO-DATE :ZeroWei:generateReleaseBuildConfig UP-TO-DATE :ZeroWei:mergeReleaseAssets UP-TO-DATE :ZeroWei:mergeReleaseResources UP-TO-DATE :ZeroWei:processReleaseManifest UP-TO-DATE :ZeroWei:processReleaseResources UP-TO-DATE :ZeroWei:generateReleaseSources UP-TO-DATE :ZeroWei:compileRelease UP-TO-DATE :ZeroWei:dexRelease UP-TO-DATE :ZeroWei:processReleaseJavaRes UP-TO-DATE :ZeroWei:packageRelease UP-TO-DATE :ZeroWei:assembleRelease UP-TO-DATE :ZeroWei:assemble UP-TO-DATE :slidingmenu:copyDebugLint UP-TO-DATE :slidingmenu:mergeDebugProguardFiles UP-TO-DATE :slidingmenu:packageDebugAidl UP-TO-DATE :slidingmenu:preDebugBuild UP-TO-DATE :slidingmenu:prepareDebugDependencies :slidingmenu:compileDebugAidl UP-TO-DATE :slidingmenu:compileDebugRenderscript UP-TO-DATE :slidingmenu:generateDebugBuildConfig UP-TO-DATE :slidingmenu:mergeDebugAssets UP-TO-DATE :slidingmenu:mergeDebugResources UP-TO-DATE :slidingmenu:processDebugManifest UP-TO-DATE :slidingmenu:processDebugResources UP-TO-DATE :slidingmenu:generateDebugSources UP-TO-DATE :slidingmenu:compileDebug UP-TO-DATE :slidingmenu:processDebugJavaRes UP-TO-DATE :slidingmenu:packageDebugJar UP-TO-DATE :slidingmenu:packageDebugLocalJar UP-TO-DATE :slidingmenu:packageDebugRenderscript UP-TO-DATE :slidingmenu:packageDebugResources UP-TO-DATE :slidingmenu:bundleDebug UP-TO-DATE :slidingmenu:assembleDebug UP-TO-DATE :slidingmenu:assembleRelease UP-TO-DATE :slidingmenu:assemble UP-TO-DATE BUILD SUCCESSFUL Total time: 3.599 secs