plugins { id("com.android.application") } android { namespace = "org.the_jk.testproject" compileSdk { version = release(37) } defaultConfig { applicationId = "org.the_jk.testproject" minSdk = 26 targetSdk = 37 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { optimization { enable = true packageScope = setOf("androidx.**", "kotlin.**", "kotlinx.**") } } } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } } dependencies { implementation(libs.androidx.appcompat) implementation(libs.androidx.core.ktx) implementation(libs.material) testImplementation(libs.junit) androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(libs.androidx.junit) } // kotlin-proxy: shadow the Kotlin compiler in the compile DAEMON by putting // the stub jar FIRST on its classpath (the kotlinBuildToolsApiClasspath // configuration, whose resolved file order becomes the daemon's -cp). // // KGP adds kotlin-build-tools-compat/-impl to this configuration itself, so // only the stub jar needs to be declared here - first, to win the lookup. // // Deliberately NO configuration-time resolution (no Configuration.files / // .incoming access): AGP's DependencyResolutionChecks raises // "was resolved during configuration time" for that. Declaring a dependency // does not resolve; resolution happens at execution time when the compile // task runs. val proxyStubJar = file("/home/the_jk/source/kotlin_proxy/dist/kotlin-proxy-compiler-stubs.jar") afterEvaluate { try { configurations.getByName("kotlinBuildToolsApiClasspath") .dependencies.add(dependencies.create(files(proxyStubJar))) logger.lifecycle("kotlin-proxy: stub jar present=" + proxyStubJar.exists()) } catch (t: Throwable) { logger.lifecycle("kotlin-proxy: AGP injection FAILED: " + t) } }