Mr.G
Mr.G

Reputation: 1275

Reduce Build time in android studio 3.2.1

In my android app, it takes approximately more than 3 minutes to build the app. If I browse through the build tasks one by one, I noticed that app:lintDebug takes the considerable amount of minutes (more than 1 minute)

It is quite annoying and i was aware to disable lint check , by putting these settings

lintOptions {
    tasks.lint.enabled = false
    quiet false
    abortOnError false
    ignoreWarnings false
    warningsAsErrors true
    checkReleaseBuilds false
}

Also in the top of the file

tasks.whenTaskAdded { task ->
    if (task.name == "lint") {
        task.enabled = false
    }
}

Also I have checked the offline Gradle build aswel.

But yet

enter image description here

Is there any others settings that i need to put to stop this?

Upvotes: 0

Views: 327

Answers (3)

Mr.G
Mr.G

Reputation: 1275

Finally i got it done by using a different task name , the gradle build for lint check has placed as lintDebug instead of lint updated skipping lint check should placed as follow

tasks.whenTaskAdded { task ->
    if (task.name == "lintDebug") {
        task.enabled = false
    }
}

Upvotes: 0

Cagdas
Cagdas

Reputation: 111

Actually build time depends on your module count. I give you some advice which use on my project(7 module)

  • Disable Instant Run.
  • Configure Gradle and here
  • If you use DexGuard or ProGuard, turn off while debug build.
  • If you use Crashlytics, check library version. It may be cause negative effect.

Upvotes: 1

Muhammad Zahab
Muhammad Zahab

Reputation: 1105

Try to work on offline mode after adding dependencies.If you want to add more dependencies just disable offline mode add dependency and then again enable offline mode. This will save a lot of your build time.I am working on a large project where build time on online mode is almost an hour while on offline mode it took some minutes to build.

To enable or disable offline mode go to: 

 -> File
 -> Settings 
 -> Build,Execution,Development -> Gradle
 -> Checked or unchecked offline work

Upvotes: 0

Related Questions