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 mainbuild.gradle
file, as shown here:
buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'org.jetbrains.kotlin:kotlin-gradle- plugin:1.1.51' } } repositories { jcenter() ...