Build.gradle.kts
buildscript {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath ("com.android.tools.build:gradle:7.0.2")
        classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30")
        classpath("gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:${Versions.spotbugsGradlePluginVersion}")
        classpath("se.bjurr.violations:violations-gradle-plugin:${Versions.violationsVersion}")
    }
}
//android {
//    compileOptions {
//        sourceCompatibility = JavaVersion.VERSION_11
//                targetCompatibility = JavaVersion.VERSION_11
//    }
//
//    kotlinOptions {
//        jvmTarget = JavaVersion.VERSION_11.toString()
//    }
//}
plugins {
    `maven-publish`
    `java-gradle-plugin`
    `kotlin-dsl`
    id ("io.gitlab.arturbosch.detekt") version ("1.18.1")
}
repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
}
dependencies {
    compileOnly(gradleApi())
    testImplementation(gradleTestKit())
    testImplementation("junit:junit:${Versions.jUnitVersion}")
}
val generatedSources = tasks.register<GenerateVersionsFileTask>("generateSources")
I get the following error:
ERROR : 'compileJava' task (current target is 11) and 'compileKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
When I uncomment android {}, I get:
Error : Script compilation errors:
Line 15: android { ^ Unresolved reference: android
 
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    