https://kotlinlang.org logo
#android
Title
# android
s

Sergio C.

09/22/2019, 9:08 PM
hello people How can I convert this to kotlin DSL?
debugimplementation = "com.squareup.leakcanary:leakcanary-android:$Versions.leakCanary"
p

pvasa

09/22/2019, 9:12 PM
debugImplementation("com.squareup.leakcanary:leakcanary-android:${Versions.leakCanary}")
s

Sergio C.

09/22/2019, 9:20 PM
nop
unresolved reference
unresolved reference for android also
l

louiscad

09/22/2019, 9:27 PM
@Sergio C. Is
Versions
written in a Groovy based gradle script?
s

Sergio C.

09/22/2019, 9:28 PM
its a .kts file
Versions.kts
ohh now it works after invalidating caches and restart
🙄
any ideas why
android
is not resolving?
this is all too buggy
l

louiscad

09/22/2019, 11:14 PM
@Sergio C. Please, be specific about what
android
you're talking about exactly in which context, I only realize what it could be now. So, I assume you mean
android { … }
in the
build.gradle.kts
file. I had it in red very very often on Android Studio 3.5 and before, but I'm no longer seeing the issue in Android Studio 3.6, so I can only encourage you to keep using Android Gradle plugin 3.5.0 but open the project with 3.6 Canary, you'll very likely get a better experience.
g

gildor

09/23/2019, 12:47 AM
You have
android
and all other type-safe accessors if you use plugins DSL to apply plugins
s

Sergio C.

09/23/2019, 12:00 PM
yes it's the
android { … }
block in the
build.gradle.kts
Well this took a while to debug. I found out that if you have some error somewhere else in the script that error might not get highlighted by the IDE but android block and everything inside is in screaming error red! ooohh ok then!
tried the AS 3.6 canary 12 and all the latest betas of gradle. Looks like to me this is still a bit rough around the edges
g

gildor

09/23/2019, 2:20 PM
Yes, tooling is not perfect. Not sure on which version of Idea As 3.6 is based on, but 3.5 is quite old and Idea 2019.2 is much better with Kotlin DSL than 2019.1
3 Views