Adding dependencies

To run tests, we must satisfy some dependencies. We will update our application configuration by extending build.gradle to support testing and to provide the classes we need. Open build.gradle and extend it as follows:

 apply plugin: "com.android.application" apply plugin: "kotlin-android" apply plugin: "kotlin-android-extensions" repositories { maven { url "https://maven.google.com" } } android { ... sourceSets { main.java.srcDirs += [ 'src/main/kotlin', 'src/common/kotlin', 'src/debug/kotlin', 'src/release/kotlin', 'src/staging/kotlin', 'src/preproduction/kotlin', 'src/debug/java', 'src/release/java', 'src/staging/java', 'src/preproduction/java', 'src/testDebug/java', 'src/testDebug/kotlin', 'src/androidTestDebug/java', ...

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.