How to create a plain Kotlin library in Android Studio?

Viewed 13

I am developing a library on Kotlin. It containst only library files and JUnit tests, no executables.

Here is my lib/build.gradle

apply plugin: 'java-library'
apply plugin: 'kotlin'

dependencies {
    implementation files('libs/fastutil-core-8.5.8.jar')
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.json:json:20180813'
    testImplementation 'org.skyscreamer:jsonassert:1.2.3'
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

This is my root build.gradle

task clean(type: Delete) {
    delete rootProject.buildDir
}

And settings.gradle

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
        maven {
            url = "https://jitpack.io"
        }
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "KotlinSpirit"
include ':lib'

After compiling the project I got this error: Plugin with id 'kotlin' not found.

What plugin should I use to make it work?

0 Answers
Related