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

aipok

01/17/2020, 7:36 AM
Good morning everyone. Do you use kotlin dsl for gradle already? Is where any usecase, except
I want to try the new thing
, why I want to switch to kotlin dsl for build files. I'm asking this, because I'm seeing a bunch of minuses with the IDE support (Android Studio in particular). Will start with pros though... DSL and kotlin build src will give an ability to nicely handle dependencies and it is working like a charm and looks clean etc. With only one minus, that ruins everything. The IDE suggestions for libraries updates are not detected anymore and not possible. Same for
flavor dimentions
if they are defined in kotlin object constans, the IDE shows warning, that no dimention are being added to any of the flavors. The build time is also increased for about a minute (with normal 6 minutes build time, it is now about 7 minutes). Does anyone knows what are the plans for support kotlin DSL from the Android Studio side? (just for reference, everything I descibed was tested with latest Android Studio 4.0 canary 😎
t

tseisel

01/17/2020, 9:10 AM
For now, most existing projects would not benefit from moving from Groovy to Kotlin Gradle DSL: • Questions on StackOverflow solve problems in Groovy • As you noted, IDE support, documentation and build speed are perfectible I'd recommend it for new projects, because : • No more black magic ! • Auto-completion • Compile-time syntax validation
m

Marek Osvald

01/17/2020, 10:04 AM
We use it in our project and except for one slight hiccup with smart-casting, we're golden.
a

Andrew

01/17/2020, 5:46 PM
The biggest issue I see is if you are not very proficient with gradle you can find code examples from groovy and not know how to convert them. And unless I was doing something wrong I copy and paste implementation lines a lot so converting those is a minor annoyance.
3 Views