2017-06-09 377 views
1

每當我點擊「立即運行」圖標沒有任何修改的源代碼,我得到2-3分鐘平均構建時間有消息Android Studio中的即時運行問題

即時運行應用代碼更改並重新啓動應用程序。字段類型更改。

我打印每個任務花了多長時間使用this並粘貼我的日誌在這裏。我強調了花費時間超過1秒的任務。

任何人都可以請快速瀏覽日誌並告訴我發生了什麼事嗎?我能做些什麼來避免這些長時間的運行時間?現在開展工作變得幾乎不可能。

Executing tasks: [:baymax:assembleDevelopmentDebug] 
Configuration on demand is an incubating feature. 
The ConfigurableReport.setDestination(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use the method ConfigurableReport.setDestination(File) instead. 
:baymax:preBuild UP-TO-DATE 
preBuild took 0.002000000 seconds 
:baymax:preDevelopmentDebugBuild UP-TO-DATE 
preDevelopmentDebugBuild took 0.002000000 seconds 
:baymax:checkDevelopmentDebugManifest 
checkDevelopmentDebugManifest took 0.003000000 seconds 
:baymax:prepareAndroidVisitsCommonUnspecifiedLibrary 
prepareAndroidVisitsCommonUnspecifiedLibrary took 0.015000000 seconds 
:baymax:prepareComAndroidDatabindingAdapters131Library 
prepareComAndroidDatabindingAdapters131Library took 0.011000000 seconds 
:baymax:prepareComAndroidDatabindingLibrary131Library 
prepareComAndroidDatabindingLibrary131Library took 0.010000000 seconds 
:baymax:prepareComAndroidSupportAnimatedVectorDrawable2531Library 
prepareComAndroidSupportAnimatedVectorDrawable2531Library took 0.004000000 seconds 
:baymax:prepareComAndroidSupportAppcompatV72531Library 
prepareComAndroidSupportAppcompatV72531Library took 0.016000000 seconds 
:baymax:prepareComAndroidSupportCardviewV72531Library 
prepareComAndroidSupportCardviewV72531Library took 0.003000000 seconds 
:baymax:prepareComAndroidSupportConstraintConstraintLayout102Library 
prepareComAndroidSupportConstraintConstraintLayout102Library took 0.007000000 seconds 
:baymax:prepareComAndroidSupportCustomtabs2531Library 
prepareComAndroidSupportCustomtabs2531Library took 0.009000000 seconds 
:baymax:prepareComAndroidSupportDesign2531Library 
prepareComAndroidSupportDesign2531Library took 0.004000000 seconds 
:baymax:prepareComAndroidSupportGridlayoutV72531Library 
prepareComAndroidSupportGridlayoutV72531Library took 0.004000000 seconds 
:baymax:prepareComAndroidSupportMultidex101Library 
prepareComAndroidSupportMultidex101Library took 0.009000000 seconds 
:baymax:prepareComAndroidSupportPaletteV72531Library 
prepareComAndroidSupportPaletteV72531Library took 0.008000000 seconds 
:baymax:prepareComAndroidSupportPercent2531Library 
prepareComAndroidSupportPercent2531Library took 0.003000000 seconds 
:baymax:prepareComAndroidSupportRecyclerviewV72531Library 
prepareComAndroidSupportRecyclerviewV72531Library took 0.002000000 seconds 
:baymax:prepareComAndroidSupportSupportCompat2531Library 
prepareComAndroidSupportSupportCompat2531Library took 0.004000000 seconds 
:baymax:prepareComAndroidSupportSupportCoreUi2531Library 
prepareComAndroidSupportSupportCoreUi2531Library took 0.010000000 seconds 
:baymax:prepareComAndroidSupportSupportCoreUtils2531Library 
prepareComAndroidSupportSupportCoreUtils2531Library took 0.012000000 seconds 
:baymax:prepareComAndroidSupportSupportFragment2531Library 
prepareComAndroidSupportSupportFragment2531Library took 0.008000000 seconds 
:baymax:prepareComAndroidSupportSupportMediaCompat2531Library 
prepareComAndroidSupportSupportMediaCompat2531Library took 0.004000000 seconds 
:baymax:prepareComAndroidSupportSupportV42531Library 
prepareComAndroidSupportSupportV42531Library took 0.008000000 seconds 
:baymax:prepareComAndroidSupportSupportVectorDrawable2531Library 
prepareComAndroidSupportSupportVectorDrawable2531Library took 0.005000000 seconds 
:baymax:prepareComAndroidSupportTransition2531Library 
prepareComAndroidSupportTransition2531Library took 0.004000000 seconds 
:baymax:prepareComBirbitAndroidPriorityJobqueue201Library 
prepareComBirbitAndroidPriorityJobqueue201Library took 0.004000000 seconds 
:baymax:prepareComFacebookAndroidFacebookAndroidSdk4220Library 
prepareComFacebookAndroidFacebookAndroidSdk4220Library took 0.003000000 seconds 
:baymax:prepareComGetbaseFloatingactionbutton1101Library 
prepareComGetbaseFloatingactionbutton1101Library took 0.004000000 seconds 
:baymax:prepareComGetkeepsafeRelinkerRelinker122Library 
prepareComGetkeepsafeRelinkerRelinker122Library took 0.008000000 seconds 
:baymax:prepareComGithubBartekscAndroidPdfViewer240Library 
prepareComGithubBartekscAndroidPdfViewer240Library took 0.009000000 seconds 
:baymax:prepareComGithubBartekscPdfiumAndroid150Library 
prepareComGithubBartekscPdfiumAndroid150Library took 0.006000000 seconds 
:baymax:prepareComGithubChrisbanesPhotoView131Library 
prepareComGithubChrisbanesPhotoView131Library took 0.018000000 seconds 
:baymax:prepareComGithubDbachelderCreditCardEntry147Library 
prepareComGithubDbachelderCreditCardEntry147Library took 0.011000000 seconds 
:baymax:prepareComGithubJakeWhartonViewPagerIndicator241Library 
prepareComGithubJakeWhartonViewPagerIndicator241Library took 0.013000000 seconds 
:baymax:prepareComGithubRahatarmanahmedCircularprogressview250Library 
prepareComGithubRahatarmanahmedCircularprogressview250Library took 0.004000000 seconds 
:baymax:prepareComGoogleAndroidGmsPlayServicesBase1100Library 
prepareComGoogleAndroidGmsPlayServicesBase1100Library took 0.014000000 seconds 
:baymax:prepareComGoogleAndroidGmsPlayServicesBasement1100Library 
prepareComGoogleAndroidGmsPlayServicesBasement1100Library took 0.008000000 seconds 
:baymax:prepareComGoogleAndroidGmsPlayServicesGcm1100Library 
prepareComGoogleAndroidGmsPlayServicesGcm1100Library took 0.003000000 seconds 
:baymax:prepareComGoogleAndroidGmsPlayServicesIid1100Library 
prepareComGoogleAndroidGmsPlayServicesIid1100Library took 0.002000000 seconds 
:baymax:prepareComGoogleAndroidGmsPlayServicesLocation1100Library 
prepareComGoogleAndroidGmsPlayServicesLocation1100Library took 0.003000000 seconds 
:baymax:prepareComGoogleAndroidGmsPlayServicesTasks1100Library 
prepareComGoogleAndroidGmsPlayServicesTasks1100Library took 0.003000000 seconds 
:baymax:prepareComGoogleFirebaseFirebaseAnalytics1100Library 
prepareComGoogleFirebaseFirebaseAnalytics1100Library took 0.008000000 seconds 
:baymax:prepareComGoogleFirebaseFirebaseAnalyticsImpl1100Library 
prepareComGoogleFirebaseFirebaseAnalyticsImpl1100Library took 0.019000000 seconds 
:baymax:prepareComGoogleFirebaseFirebaseCommon1100Library 
prepareComGoogleFirebaseFirebaseCommon1100Library took 0.014000000 seconds 
:baymax:prepareComGoogleFirebaseFirebaseCore1100Library 
prepareComGoogleFirebaseFirebaseCore1100Library took 0.015000000 seconds 
:baymax:prepareComGoogleFirebaseFirebaseIid1100Library 
prepareComGoogleFirebaseFirebaseIid1100Library took 0.014000000 seconds 
:baymax:prepareComIntercomAndroidComposer102Library 
prepareComIntercomAndroidComposer102Library took 0.010000000 seconds 
:baymax:prepareComIntercomAndroidComposerGallery102Library 
prepareComIntercomAndroidComposerGallery102Library took 0.019000000 seconds 
:baymax:prepareComJakewhartonButterknife810Library 
prepareComJakewhartonButterknife810Library took 0.004000000 seconds 
:baymax:prepareComKailashdabhiOmRecorder110Library 
prepareComKailashdabhiOmRecorder110Library took 0.010000000 seconds 
:baymax:prepareComMakeramenRoundedimageview230Library 
prepareComMakeramenRoundedimageview230Library took 0.004000000 seconds 
:baymax:prepareComSquareupLeakcanaryLeakcanaryAndroidNoOp15Library 
prepareComSquareupLeakcanaryLeakcanaryAndroidNoOp15Library took 0.013000000 seconds 
:baymax:prepareComStripeStripeAndroid301Library 
prepareComStripeStripeAndroid301Library took 0.011000000 seconds 
:baymax:prepareComTwilioVideoAndroid101Library 
prepareComTwilioVideoAndroid101Library took 0.005000000 seconds 
:baymax:prepareFmJiecaoJiecaovideoplayer363Library 
prepareFmJiecaoJiecaovideoplayer363Library took 0.009000000 seconds 
:baymax:prepareIoBranchSdkAndroidLibrary280Library 
prepareIoBranchSdkAndroidLibrary280Library took 0.002000000 seconds 
:baymax:prepareIoIntercomAndroidIntercomSdk320Library 
prepareIoIntercomAndroidIntercomSdk320Library took 0.003000000 seconds 
:baymax:prepareIoIntercomAndroidIntercomSdkBase320Library 
prepareIoIntercomAndroidIntercomSdkBase320Library took 0.007000000 seconds 
:baymax:prepareIoIntercomAndroidIntercomSdkGcm320Library 
prepareIoIntercomAndroidIntercomSdkGcm320Library took 0.021000000 seconds 
:baymax:prepareIoReactivexRxandroid121Library 
prepareIoReactivexRxandroid121Library took 0.011000000 seconds 
:baymax:prepareIoRealmRealmAndroidLibrary231Library 
prepareIoRealmRealmAndroidLibrary231Library took 0.006000000 seconds 
:baymax:prepareNetHockeyappAndroidHockeySDK400Library 
prepareNetHockeyappAndroidHockeySDK400Library took 0.003000000 seconds 
:baymax:prepareNetYprestoAndroidtranscoderAndroidTranscoder0110Library 
prepareNetYprestoAndroidtranscoderAndroidTranscoder0110Library took 0.008000000 seconds 
:mixpanel-android-4.9.0:preBuild UP-TO-DATE 
preBuild took 0.003000000 seconds 
:mixpanel-android-4.9.0:preReleaseBuild UP-TO-DATE 
preReleaseBuild took 0.005000000 seconds 
:mixpanel-android-4.9.0:checkReleaseManifest 
checkReleaseManifest took 0.009000000 seconds 
:mixpanel-android-4.9.0:preReleaseUnitTestBuild UP-TO-DATE 
preReleaseUnitTestBuild took 0.001000000 seconds 
:mixpanel-android-4.9.0:prepareComAndroidSupportSupportV42400Library 
prepareComAndroidSupportSupportV42400Library took 0.007000000 seconds 
:mixpanel-android-4.9.0:prepareComGoogleAndroidGmsPlayServicesBase1021Library 
prepareComGoogleAndroidGmsPlayServicesBase1021Library took 0.004000000 seconds 
:mixpanel-android-4.9.0:prepareComGoogleAndroidGmsPlayServicesBasement1021Library 
prepareComGoogleAndroidGmsPlayServicesBasement1021Library took 0.009000000 seconds 
:mixpanel-android-4.9.0:prepareComGoogleAndroidGmsPlayServicesGcm1021Library 
prepareComGoogleAndroidGmsPlayServicesGcm1021Library took 0.006000000 seconds 
:mixpanel-android-4.9.0:prepareComGoogleAndroidGmsPlayServicesIid1021Library 
prepareComGoogleAndroidGmsPlayServicesIid1021Library took 0.003000000 seconds 
:mixpanel-android-4.9.0:prepareComGoogleAndroidGmsPlayServicesTasks1021Library 
prepareComGoogleAndroidGmsPlayServicesTasks1021Library took 0.013000000 seconds 
:mixpanel-android-4.9.0:prepareReleaseDependencies 
prepareReleaseDependencies took 0.003000000 seconds 
:mixpanel-android-4.9.0:compileReleaseAidl UP-TO-DATE 
compileReleaseAidl took 0.024000000 seconds 
:mixpanel-android-4.9.0:compileReleaseNdk NO-SOURCE 
compileReleaseNdk took 0.003000000 seconds 
:mixpanel-android-4.9.0:compileLint UP-TO-DATE 
compileLint took 0.002000000 seconds 
:mixpanel-android-4.9.0:copyReleaseLint NO-SOURCE 
copyReleaseLint took 0.001000000 seconds 
:mixpanel-android-4.9.0:compileReleaseRenderscript UP-TO-DATE 
compileReleaseRenderscript took 0.019000000 seconds 
:mixpanel-android-4.9.0:generateReleaseBuildConfig UP-TO-DATE 
generateReleaseBuildConfig took 0.007000000 seconds 
:mixpanel-android-4.9.0:generateReleaseResValues UP-TO-DATE 
generateReleaseResValues took 0.003000000 seconds 
:mixpanel-android-4.9.0:generateReleaseResources UP-TO-DATE 
generateReleaseResources took 0.001000000 seconds 
:mixpanel-android-4.9.0:mergeReleaseResources UP-TO-DATE 
mergeReleaseResources took 0.332000000 seconds 
:mixpanel-android-4.9.0:processReleaseManifest UP-TO-DATE 
processReleaseManifest took 0.008000000 seconds 
:mixpanel-android-4.9.0:processReleaseResources UP-TO-DATE 
processReleaseResources took 0.036000000 seconds 
:mixpanel-android-4.9.0:generateReleaseSources UP-TO-DATE 
generateReleaseSources took 0.001000000 seconds 
:mixpanel-android-4.9.0:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE 
incrementalReleaseJavaCompilationSafeguard took 0.002000000 seconds 
:mixpanel-android-4.9.0:javaPreCompileRelease 
javaPreCompileRelease took 0.001000000 seconds 
:mixpanel-android-4.9.0:compileReleaseJavaWithJavac UP-TO-DATE 
compileReleaseJavaWithJavac took 0.045000000 seconds 
:mixpanel-android-4.9.0:extractReleaseAnnotations UP-TO-DATE 
extractReleaseAnnotations took 0.016000000 seconds 
:mixpanel-android-4.9.0:mergeReleaseShaders UP-TO-DATE 
mergeReleaseShaders took 0.003000000 seconds 
:mixpanel-android-4.9.0:compileReleaseShaders UP-TO-DATE 
compileReleaseShaders took 0.008000000 seconds 
:mixpanel-android-4.9.0:generateReleaseAssets UP-TO-DATE 
generateReleaseAssets took 0.002000000 seconds 
:mixpanel-android-4.9.0:mergeReleaseAssets UP-TO-DATE 
mergeReleaseAssets took 0.004000000 seconds 
:mixpanel-android-4.9.0:mergeReleaseProguardFiles UP-TO-DATE 
mergeReleaseProguardFiles took 0.001000000 seconds 
:mixpanel-android-4.9.0:packageReleaseRenderscript NO-SOURCE 
packageReleaseRenderscript took 0.002000000 seconds 
:mixpanel-android-4.9.0:packageReleaseResources UP-TO-DATE 
packageReleaseResources took 0.049000000 seconds 
:mixpanel-android-4.9.0:processReleaseJavaRes NO-SOURCE 
processReleaseJavaRes took 0.007000000 seconds 
:mixpanel-android-4.9.0:transformResourcesWithMergeJavaResForRelease UP-TO-DATE 
transformResourcesWithMergeJavaResForRelease took 0.010000000 seconds 
:mixpanel-android-4.9.0:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE 
transformClassesAndResourcesWithSyncLibJarsForRelease took 0.008000000 seconds 
:mixpanel-android-4.9.0:mergeReleaseJniLibFolders UP-TO-DATE 
mergeReleaseJniLibFolders took 0.003000000 seconds 
:mixpanel-android-4.9.0:transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE 
transformNativeLibsWithMergeJniLibsForRelease took 0.009000000 seconds 
:mixpanel-android-4.9.0:transformNativeLibsWithStripDebugSymbolForRelease UP-TO-DATE 
transformNativeLibsWithStripDebugSymbolForRelease took 0.014000000 seconds 
:mixpanel-android-4.9.0:transformNativeLibsWithSyncJniLibsForRelease UP-TO-DATE 
transformNativeLibsWithSyncJniLibsForRelease took 0.007000000 seconds 
:mixpanel-android-4.9.0:bundleRelease UP-TO-DATE 
bundleRelease took 0.034000000 seconds 
:baymax:prepareDevelopmentDebugDependencies 
prepareDevelopmentDebugDependencies took 0.002000000 seconds 
:baymax:compileDevelopmentDebugRenderscript UP-TO-DATE 
compileDevelopmentDebugRenderscript took 0.020000000 seconds 
:baymax:generateDevelopmentDebugResValues UP-TO-DATE 
generateDevelopmentDebugResValues took 0.003000000 seconds 
:baymax:processDevelopmentDebugGoogleServices 
Parsing json file: /Users/mwajeeh/android/baymax/src/debug/google-services.json 
processDevelopmentDebugGoogleServices took 0.010000000 seconds 
:baymax:generateDevelopmentDebugResources 
generateDevelopmentDebugResources took 0E-9 seconds 
:baymax:mergeDevelopmentDebugResources UP-TO-DATE 
mergeDevelopmentDebugResources took 0.700000000 seconds 
:baymax:dataBindingProcessLayoutsDevelopmentDebug UP-TO-DATE 
dataBindingProcessLayoutsDevelopmentDebug took 0.277000000 seconds 
:baymax:buildInfoDevelopmentDebugLoader 
buildInfoDevelopmentDebugLoader took 0.016000000 seconds 
:baymax:compileDevelopmentDebugAidl UP-TO-DATE 
compileDevelopmentDebugAidl took 0.064000000 seconds 
:baymax:nodeSetup UP-TO-DATE 
nodeSetup took 0.445000000 seconds 
:baymax:installApolloCodegen 
[email protected] /Users/mwajeeh/android/baymax 
-- [email protected] 


`**installApolloCodegen took 17.282000000 seconds**<<<<<<<<<<<<` 


:baymax:generateDevelopmentDebugApolloIR UP-TO-DATE 
generateDevelopmentDebugApolloIR took 0.015000000 seconds 
:baymax:generateDevelopmentDebugApolloClasses UP-TO-DATE 
generateDevelopmentDebugApolloClasses took 0.008000000 seconds 
:baymax:generateDevelopmentDebugBuildConfig 
generateDevelopmentDebugBuildConfig took 0.023000000 seconds 
:baymax:processDevelopmentArm64-v8aDebugManifest 
processDevelopmentArm64-v8aDebugManifest took 0.462000000 seconds 
:baymax:processDevelopmentArm64-v8aDebugResources UP-TO-DATE 
processDevelopmentArm64-v8aDebugResources took 0.085000000 seconds 
:baymax:processDevelopmentArmeabi-v7aDebugManifest 
processDevelopmentArmeabi-v7aDebugManifest took 0.386000000 seconds 
:baymax:processDevelopmentArmeabi-v7aDebugResources UP-TO-DATE 
processDevelopmentArmeabi-v7aDebugResources took 0.173000000 seconds 
:baymax:processDevelopmentUniversalDebugManifest 
processDevelopmentUniversalDebugManifest took 0.591000000 seconds 
:baymax:processDevelopmentUniversalDebugResources UP-TO-DATE 
processDevelopmentUniversalDebugResources took 0.100000000 seconds 
:baymax:processDevelopmentX86DebugManifest 
processDevelopmentX86DebugManifest took 0.416000000 seconds 
:baymax:processDevelopmentX86DebugResources UP-TO-DATE 
processDevelopmentX86DebugResources took 0.082000000 seconds 
:baymax:processDevelopmentX86_64DebugManifest 
processDevelopmentX86_64DebugManifest took 0.461000000 seconds 
:baymax:processDevelopmentX86_64DebugResources UP-TO-DATE 
processDevelopmentX86_64DebugResources took 0.161000000 seconds 
:baymax:generateDevelopmentDebugSources 
generateDevelopmentDebugSources took 0.006000000 seconds 
:baymax:dataBindingExportBuildInfoDevelopmentDebug 
dataBindingExportBuildInfoDevelopmentDebug took 0.201000000 seconds 
:baymax:incrementalDevelopmentDebugJavaCompilationSafeguard 


`**incrementalDevelopmentDebugJavaCompilationSafeguard took 1.952000000 seconds**<<<<<<<<<<<<<<<<<<<<` 


:baymax:javaPreCompileDevelopmentDebug 
javaPreCompileDevelopmentDebug took 0.010000000 seconds 
:baymax:transformClassesAndDataBindingWithDataBindingMergeArtifactsForDevelopmentDebug UP-TO-DATE 
transformClassesAndDataBindingWithDataBindingMergeArtifactsForDevelopmentDebug took 0.212000000 seconds 
:baymax:compileDevelopmentDebugJavaWithJavac 
.... 
couple of warnings about "View field image collides with a variable or import" 
    25 warnings 
... 


`**compileDevelopmentDebugJavaWithJavac took 106.659000000 seconds**<<<<<<<<<<<<<<<<<<<<` 


:baymax:mergeDevelopmentDebugShaders UP-TO-DATE 
mergeDevelopmentDebugShaders took 0.044000000 seconds 
:baymax:compileDevelopmentDebugShaders UP-TO-DATE 
compileDevelopmentDebugShaders took 0.023000000 seconds 
:baymax:generateDevelopmentDebugAssets UP-TO-DATE 
generateDevelopmentDebugAssets took 0.016000000 seconds 
:baymax:mergeDevelopmentDebugAssets UP-TO-DATE 
mergeDevelopmentDebugAssets took 0.248000000 seconds 
:baymax:processDevelopmentDebugJavaRes NO-SOURCE 
processDevelopmentDebugJavaRes took 0.002000000 seconds 
:baymax:transformResourcesWithMergeJavaResForDevelopmentDebug UP-TO-DATE 
transformResourcesWithMergeJavaResForDevelopmentDebug took 0.036000000 seconds 
:baymax:packageInstantRunResourcesDevelopmentArm64-v8aDebug UP-TO-DATE 
packageInstantRunResourcesDevelopmentArm64-v8aDebug took 0.155000000 seconds 
:baymax:fastDeployDevelopmentDebugExtractor UP-TO-DATE 
fastDeployDevelopmentDebugExtractor took 0.006000000 seconds 
:baymax:generateDevelopmentDebugInstantRunAppInfo UP-TO-DATE 
generateDevelopmentDebugInstantRunAppInfo took 0.044000000 seconds 
:baymax:checkManifestChangesDevelopmentDebug 
checkManifestChangesDevelopmentDebug took 0.025000000 seconds 
:baymax:transformClassesWithExtractJarsForDevelopmentDebug UP-TO-DATE 
transformClassesWithExtractJarsForDevelopmentDebug took 0.051000000 seconds 
:baymax:transformClassesWithRealmTransformerForDevelopmentDebug 
transformClassesWithRealmTransformerForDevelopmentDebug took 30.824000000 seconds 
:baymax:transformClassesWithInstantRunVerifierForDevelopmentDebug 
transformClassesWithInstantRunVerifierForDevelopmentDebug took 0.526000000 seconds 
:baymax:transformClassesWithDependencyCheckerForDevelopmentDebug UP-TO-DATE 
transformClassesWithDependencyCheckerForDevelopmentDebug took 0.039000000 seconds 
:baymax:compileDevelopmentDebugNdk NO-SOURCE 
compileDevelopmentDebugNdk took 0.018000000 seconds 
:baymax:mergeDevelopmentDebugJniLibFolders UP-TO-DATE 
mergeDevelopmentDebugJniLibFolders took 0.012000000 seconds 
:baymax:transformNativeLibsWithMergeJniLibsForDevelopmentDebug UP-TO-DATE 
transformNativeLibsWithMergeJniLibsForDevelopmentDebug took 0.075000000 seconds 
:baymax:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDevelopmentDebug UP-TO-DATE 
transformNativeLibsAndResourcesWithJavaResourcesVerifierForDevelopmentDebug took 0.008000000 seconds 
:baymax:transformClassesWithInstantRunForDevelopmentDebug 


`**transformClassesWithInstantRunForDevelopmentDebug took 1.158000000 seconds**<<<<<<<<<<<<<<<<<<<<` 


:baymax:transformClassesEnhancedWithInstantReloadDexForDevelopmentDebug 
transformClassesEnhancedWithInstantReloadDexForDevelopmentDebug took 0.052000000 seconds 
:baymax:incrementalDevelopmentDebugTasks 
incrementalDevelopmentDebugTasks took 0.019000000 seconds 
:baymax:preColdswapDevelopmentDebug 
preColdswapDevelopmentDebug took 0.004000000 seconds 
:baymax:transformClassesWithInstantRunSlicerForDevelopmentDebug 
transformClassesWithInstantRunSlicerForDevelopmentDebug took 0.974000000 seconds 
:baymax:transformClassesWithDexForDevelopmentDebug 


`**transformClassesWithDexForDevelopmentDebug took 29.440000000 seconds****<<<<<<<<<<<<<<<<<<<<` 


:baymax:validateSigningDevelopmentArm64-v8aDebug 
validateSigningDevelopmentArm64-v8aDebug took 0.007000000 seconds 
:baymax:transformDexWithInstantRunDependenciesApkForDevelopmentDebug 
transformDexWithInstantRunDependenciesApkForDevelopmentDebug took 0.077000000 seconds 
:baymax:transformDexWithInstantRunSlicesApkForDevelopmentDebug 


`**transformDexWithInstantRunSlicesApkForDevelopmentDebug took 1.007000000 seconds**<<<<<<<<<<<<<<<<<<<<` 



:baymax:transformNativeLibsWithStripDebugSymbolForDevelopmentDebug UP-TO-DATE 
transformNativeLibsWithStripDebugSymbolForDevelopmentDebug took 0.018000000 seconds 
:baymax:packageDevelopmentArm64-v8aDebug UP-TO-DATE 
packageDevelopmentArm64-v8aDebug took 0.249000000 seconds 
:baymax:buildInfoGeneratorDevelopmentDebug 
buildInfoGeneratorDevelopmentDebug took 0.022000000 seconds 
:baymax:assembleDevelopmentArm64-v8aDebug UP-TO-DATE 
assembleDevelopmentArm64-v8aDebug took 0.008000000 seconds 
:baymax:compileDevelopmentDebugSources 
compileDevelopmentDebugSources took 0.003000000 seconds 
:baymax:assembleDevelopmentDebug 
assembleDevelopmentDebug took 0.001000000 seconds 

BUILD SUCCESSFUL in 3m 28s 
147 actionable tasks: 96 executed, 51 avoided (35%) 

回答

2

此視頻確實幫助https://www.youtube.com/watch?v=7ll-rkLCtyk減少了我的構建時間。還有與此相關的視頻的優秀博客文章:https://android.jlelse.eu/how-to-speed-up-your-slow-gradle-builds-5d9a9545f91a

我下面的東西來提高速度:

  • 禁用ABI拆分開發(你只需要根據要做到這一點,如果你正在創建不同的APK在CPU架構):

    splits { 
        abi { 
         enable !project.hasProperty('devBuild') 
        } 
    } 
    
  • 禁用PNG發展排排坐:

    android { 
        if (project.hasProperty('devBuild')) { 
         aaptOptions.cruncherEnabled = false 
        } 
    } 
    
  • 不要修改BuildConfig每次當你點擊運行:

    def gitSha = project.hasProperty('devBuild') ? "gitSha_devBuild" : 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() 
    def buildTime = project.hasProperty('devBuild') ? "buildTime_devBuild" : new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")) 
    

    再後來:

    buildConfigField "String", "GIT_SHA", "\"${gitSha}\"" 
    buildConfigField "String", "BUILD_TIME", "\"${buildTime}\"" 
    
  • 築起minSdkVersion 21開發期間只針對你所需要的資源你的開發設備(在我的情況下它是「en」和「xxhdpi」):

    productFlavors { 
        fast { 
         // Enable pre-dexing to produce an APK that can be tested on 
         // Android 5.0+ without the time-consuming DEX build processes. 
         minSdkVersion 21 
         //only package english translations, and xxhdpi resources 
         resConfigs("en", "xxhdpi") 
        } 
        slow { 
         // The actual minSdkVersion for the production version. 
         minSdkVersion 16 
        } 
    } 
    
  • 移動到com.android.tools.build.gradle:3.X.X

現在我的建造速度爲10秒到1分鐘!

+1

感謝您幫助我意識到阻止我的構建與InstantRun一起使用的是BuildConfig常量! 而不是使用'devBuild'標誌,你可以爲'fast'和'slow'味道(或者'debug'和'release'構造類型)分別聲明'buildConfigField's。 –