Updating dependencies

If you switch 100% pure Java code of the Android project into Kotlin, you have to start from the bottom up. This means that your first migration effort will be to update your dependencies. You must change your build.gradle configuration so Kotlin is recognized and source code paths are available. We already explained how to do this in Chapter 1, Starting with Android, in the Setting up Gradle section; so, if your project does not have Kotlin-related configuration in it, you have to provide it.

Let's recapitulate our Gradle configuration:

  • The build.gradle root project represents the main build.gradle file, as shown here:
 buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' ...

Get Mastering Android Development with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.