Hello :wave::skin-tone-3: I’m trying to set a `lin...
# gradle
l
Hello 👋🏼 I’m trying to set a
lintBaseline
, following the docs, I should use:
Copy code
lint {
   baseline file("lint-baseline.xml")
}
But this give me this error:
Copy code
* What went wrong:
'void com.android.build.api.dsl.Lint.baseline(java.io.File)'
While using
Copy code
lint {
   baseline(file("lint-baseline.xml"))
}
Give me this error:
Copy code
Unable to find method ''void com.android.build.api.dsl.Lint.baseline(java.io.File)''
'void com.android.build.api.dsl.Lint.baseline(java.io.File)'
Anyone know how to solve this? Which is the correct(current) syntax for a
.gradle.kts
file? Thread in Slack Conversation
v
Are you sure you are in a Kotlin DSL build script? Because the first variant you showed should not compile in that case. Besides that your question is slightly off-topic as it is not about "how to use Kotlin in Gradle build scripts" but about "how do I configure the Android plugin properly".
l
I’m in the block
android {}
in my
build.gradle.kts
file
v
Anyway, the docs say it should be
Copy code
android {
    lint {
        baseline = file("lint-baseline.xml")
    }
}
l
I posted that on Android and was told to share it here since someone might be able to help 🙂
l
Yep that doesn’t work
v
Why not?
l
build.gradle.kts:25:9: Function invocation 'baseline(...)' expected
v
Can it produce a build
--scan
that you can share?
l
Copy code
* What went wrong:
Script compilation errors:

  Line 25:         baseline = file("lint-baseline.xml")
                   ^ Function invocation 'baseline(...)' expected

  Line 25:         baseline = file("lint-baseline.xml")
                   ^ None of the following functions can be called with the arguments supplied: 
                       public abstract fun baseline(baselineFile: File): Unit defined in com.android.build.api.dsl.Lint
                       public abstract fun baseline(baseline: String): Unit defined in com.android.build.api.dsl.Lint

2 errors
v
Can it produce a build
--scan
that you can share?
l
that’s what I get when running
./gradlew build --scan
v
If you
Ctrl+Click
the
baseline
, where do you end up?
Here
baseline = file("")
works fine as
baseline
is a
File
property of
Lint