jishindev
10/22/2019, 1:41 PMwire3
on Android with Gradle Kotlin DSL. It does not compile once I add the gradle plugin to the app level gradle file. I have the following in my gradle config right now-
Project level
-------------------------------------
buildscript {
repositories {
...
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.1")
classpath(kotlin("gradle-plugin", version = "1.3.40"))
classpath("com.squareup.wire:wire-gradle-plugin:3.0.0")
}
}
--------------------------------------
App level
--------------------------------------
plugins {
id("com.android.application")
kotlin("android")
kotlin("android.extensions")
kotlin("kapt")
id("com.squareup.wire") // GIVES - "Task with name 'compileJava' not found in project ':app'." WHEN ADDED
}
android {
compileSdkVersion(29)
defaultConfig {
applicationId = "<http://com.example.android.app|com.example.android.app>"
minSdkVersion(23)
targetSdkVersion(29)
...
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
sourceSets.onEach {
it.java.srcDir("src/${it.name}/kotlin")
}
sourceSets.getByName("main")
.java.srcDirs(file("$buildDir/generated/source/wire"))
}
// Wire
wire { // wire DOES NOT RESOLVE
kotlin{}
}
val kotlinVersion = "1.3.40"
val wireVersion = "3.0.1"
dependencies {
implementation(kotlin("stdlib-jdk7", version = kotlinVersion))
...
implementation("com.squareup.wire:wire-runtime:$wireVersion")
implementation("com.squareup.wire:wire-grpc-client:$wireVersion")
}
Anything that I'm missing here?