To continue past this, we’ll convert the default Gradle scripts to use Kotlin instead. When you create a project in Android Studio, it creates a Gradle script using Groovy by default. Plus, since we use Kotlin for day-to-day development on Android apps, editing those Gradle files isn’t as much of a cognitive load since we’re familiar with the language’s syntax. Since Kotlin is statically typed, it’s simpler for the IDE to fill in helpful hints about the code. Furthermore, since Gradle scripts are the only thing I typically see Groovy in, the syntax is way more difficult for me to parse than that of Kotlin, which I use every day during app development.īy writing our Gradle scripts in Kotlin instead of Groovy, we can solve both these problems. Groovy is dynamically typed, so Android Studio has a tough time providing you with intelligent hints about what methods you can call, what parameters they take, and when you’ve done something wrong. I don’t know about you, but editing Gradle Groovy files is not my favorite part about Android development. The full feature set of Gradle Kotlin DSL is supported on less IDEs than Groovy, but Android Studio and IntelliJ IDEA support everything we need, so most Android developers shouldn’t have a lot of issues. This has all of your favorite functions and assignments from the Gradle Groovy DSL, but now in Kotlin. Gradle Kotlin DSL is a domain specific language built with the express purpose of defining Gradle build plans. The folks at Gradle recently released version 5.0, which means that us Android developers now have access to Gradle Kotlin DSL v1.0! This means that we can write Gradle build scripts in our favorite language, Kotlin.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |