Nicholas Doglio
01/12/2021, 1:20 AMbuild.gradle
file to enable kapt to work properly when using JDK 15 to build? I keep getting this error `package javax.annotation.processing does not exist import javax.annotation.processing.Generated`whenever I try to build. My config is the following:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}
kapt {
javacOptions {
option("-source", "8")
option("-target", "8")
}
}
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.ndoglio.daggerkapt"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.dagger:dagger:2.30.1'
kapt 'com.google.dagger:dagger-compiler:2.30.1'
}
radityagumay
01/12/2021, 1:22 AMjw
01/12/2021, 1:40 AMradityagumay
01/12/2021, 1:41 AMjw
01/12/2021, 1:41 AMradityagumay
01/12/2021, 1:42 AMNicholas Doglio
01/12/2021, 1:50 AMjw
01/12/2021, 1:55 AMNicholas Doglio
01/12/2021, 1:56 AMDaggerAppComponent
the above file is just a simple project to reproduce the error, I just added a AppComponent
and tried to build itjuliocbcotta
01/13/2021, 6:49 PMjuliocbcotta
01/13/2021, 6:49 PMNicholas Doglio
01/16/2021, 6:45 PMkapt
extension. Changing it to the following with two dashes fixes the issue and builds correctly.
kapt {
javacOptions {
option("--source", "8")
option("--target", "8")
}
}