4

I've been experiencing build performances problems on my Mac since i started converting a project from java to kotlin.

I use gradle with Android Studio 3.0.1

The problem is that when i build/run/compile the source code I get a lot of warnings from the gradle console that are about code naming conventions, let me show you

I think that this is slowing down my build. I also tried to tweak a little bit my gradle configuration file and build script but nothing happened

org.gradle.daemon=true
org.gradle.jvmargs=-Xmx3072m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true

And also in my build.gradle top

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

...

lintOptions {
    checkAllWarnings false
    checkReleaseBuilds false
    ignoreWarnings true       // false by default
    quiet true                // false by default
    tasks.lint.enabled = false
}

And I set the compiler parameters to -x lint, so I'm surprised by this error Anyone has the same problem?

sepp2k
  • 363,768
  • 54
  • 674
  • 675
ci0ccarellia
  • 795
  • 9
  • 26
  • See https://stackoverflow.com/questions/29046636/mark-unused-parameters-in-kotlin – Renato Mar 16 '18 at 22:32
  • 2
    *Parameter "X" is never used. Could be renamed to _* Why don't you follow the prompts and rename those. The warnings will definitely go away. – Onik Mar 16 '18 at 22:36
  • 1
    As the first warnings indicate, change 'compile' to 'implementation', etc, as that will dramatically improve build performance. – KTCO Mar 17 '18 at 15:23
  • _Why don't you follow the prompts_ : It's debetable whether or not it's good practice to hide the variable name for unused anonymous functions. I think it's weird that the Kotlin compiler makes that decision for us and make it a warning. – Nilzor Jun 22 '21 at 20:27

1 Answers1

9

The warnings that you see are reported by the Kotlin compiler, not by Android Lint, so lintOptions won't affect them.

Instead, if you want to suppress the warnings, you can configure a single Kotlin compilation task to suppress its warnings:

compileDebugKotlin {
    kotlinOptions.suppressWarnings = true
}

Or suppress the warnings from all Kotlin compilation tasks:

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions.suppressWarnings = true
}

Though in fact, these warnings should not affect the build performance in any noticeable way.

hotkey
  • 140,743
  • 39
  • 371
  • 326
  • 1
    Is there any way to solve this without suppressing them? – c-an Apr 29 '19 at 09:24
  • Yes, it does not directly affect build performance but when warnings are in 3 or 4 digits it shows down the system while printing them. So indirectly it affects the build system. But if u have that many warnings please try to solve them. But In that case suppressing warning will help build performance and reading app build trace – Aniket Bhoite Sep 02 '21 at 07:22
  • even though I suppressed the warnings from all compilation tasks they are still shown! any idea why? – AouledIssa Oct 02 '21 at 11:09