user6265154
user6265154

Reputation: 363

Gradle build taking too long

Executing tasks: [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar, :app:assembleDebug]

Parallel execution with configuration on demand is an incubating feature. Incremental java compilation is an incubating feature. :app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareAsiaIvityAndroidMarqueeview115Library :app:prepareComAndraskindlerParallaxviewpagerParallaxviewpager031Library :app:prepareComAndroidSupportAnimatedVectorDrawable2321Library :app:prepareComAndroidSupportAppcompatV72321Library :app:prepareComAndroidSupportMultidex101Library :app:prepareComAndroidSupportRecyclerviewV72321Library :app:prepareComAndroidSupportSupportV42321Library :app:prepareComAndroidSupportSupportVectorDrawable2321Library :app:prepareComGithubTecheryProgresshintLibrary023Library :app:prepareComGithubTecheryProgresshintLibraryAddition023Library :app:prepareComH6ah4iAndroidWidgetVerticalseekbarVerticalseekbar051Library :app:prepareComOgaclejapanSmarttablayoutLibrary160Library :app:prepareComToxicBakeryViewpagerTransformsViewPagerTransforms1232Library :app:prepareDebugDependencies :app:compileDebugAidl :app:compileDebugRenderscript :app:generateDebugBuildConfig :app:mergeDebugShaders :app:compileDebugShaders :app:generateDebugAssets :app:mergeDebugAssets :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources :app:mergeDebugResources :app:processDebugManifest :app:processDebugResources :app:generateDebugSources :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareComAndroidSupportMultidexInstrumentation101Library :app:prepareDebugAndroidTestDependencies :app:compileDebugAndroidTestAidl :app:processDebugAndroidTestManifest :app:compileDebugAndroidTestRenderscript :app:generateDebugAndroidTestBuildConfig :app:mergeDebugAndroidTestShaders :app:compileDebugAndroidTestShaders :app:generateDebugAndroidTestAssets :app:mergeDebugAndroidTestAssets :app:generateDebugAndroidTestResValues UP-TO-DATE :app:generateDebugAndroidTestResources :app:mergeDebugAndroidTestResources :app:processDebugAndroidTestResources :app:generateDebugAndroidTestSources :app:preDebugUnitTestBuild UP-TO-DATE :app:prepareDebugUnitTestDependencies :app:mockableAndroidJar UP-TO-DATE :app:incrementalDebugJavaCompilationSafeguard :app:compileDebugJavaWithJavac :app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.

:app:compileDebugNdk UP-TO-DATE :app:compileDebugSources :app:buildInfoDebugLoader :app:transformClassesWithExtractJarsForDebug :app:transformClassesWithInstantRunVerifierForDebug :app:transformClassesWithJavaResourcesVerifierForDebug UP-TO-DATE :app:mergeDebugJniLibFolders :app:transformNative_libsWithMergeJniLibsForDebug :app:processDebugJavaRes UP-TO-DATE :app:transformResourcesWithMergeJavaResForDebug :app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug UP-TO-DATE :app:transformClassesWithInstantRunForDebug :app:transformClasses_enhancedWithInstant+reloadDexForDebug :app:incrementalDebugTasks :app:prePackageMarkerForDebug :app:fastDeployDebugExtractor :app:generateDebugInstantRunAppInfo :app:coldswapKickerDebug :app:transformClassesWithInstantRunSlicerForDebug :app:transformClassesWithDexForDebug To run dex in process, the Gradle daemon needs a larger heap. It currently has approximately 11833 MB. For faster builds, increase the maximum heap size for the Gradle daemon to more than 13312 MB. To do this set org.gradle.jvmargs=-Xmx13312M in the project gradle.properties. For more information see https://docs.gradle.org/current/userguide/build_environment.html :app:validateDebugSigning :app:packageDebug :app:zipalignDebug :app:fullDebugBuildInfoGenerator :app:assembleDebug

BUILD SUCCESSFUL

Total time: 7 mins 41.523 secs

Upvotes: 0

Views: 8541

Answers (3)

user6265154
user6265154

Reputation: 363

My problem is solved.It was taking time because i have ubuntu and i was opening and running my project from external ntfs hard drive.I reformatted it as ext4 and followed the post given in comment section by Amit Vaghela , which reduced the build time from 7 min to 2 sec.

This is the link given by 'Amit Vaghela':

Building and running app via Gradle and Android Studio is slower than via Eclipse

Upvotes: 1

malmling
malmling

Reputation: 2518

The default Gradle Daemon VM memory allocation is 1 gigabyte — which is insufficient to support dexInProcess, so to take advantage you’ll need to set it to at least 2 gigabytes.

One thing you could do to speed up your builds is to increase the Gradle Daemon VM memory allocation.

In gradle.properties add the line org.gradle.jvmargs=-Xmx2048m.

Good read about Android Studio 2.1 feature Dex In Process:

https://medium.com/google-developers/faster-android-studio-builds-with-dex-in-process-5988ed8aa37e?_utm_source=1-2-2#.g4ba8piij

And also check out the video:

https://www.youtube.com/watch?v=-SY5nkNVUn0

Upvotes: 2

Gaurav
Gaurav

Reputation: 3763

Make your gradle offline.

Goto File -> Settings search for gradle and checked offline work .

enter image description here

Upvotes: 1

Related Questions