나는 다음과 같은 문제에 봉착 : - 만든 몇 가지 모듈 Component
클래스를 구현하며 @AutoService(Component::class)
주석의 - 내 안드로이드 응용 프로그램은 이러한 클래스를 검색 할 ServiceLoader
을 사용하고 있습니다. 그러나 어떤 이유로 kapt
이 META-INF/services/...
코 틀린 주석 프로세서 + 자동차 서비스
내 모듈 gradle.file 내부의 파일을 생성되지 않습니다
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation project(':common-dependencies')
implementation project(':component')
compileOnly 'com.google.auto.service:auto-service:1.0-rc3'
kapt "com.google.auto.service:auto-service:1.0-rc3"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
내 앱의 build.gradle 파일 : 나는 이유를 모르겠어요
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.test.sampleapp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}
flavorDimensions 'required-notused'
productFlavors {
brandA {
resValue "string", "app_name", "Brand A"
}
brandB {
resValue "string", "app_name", "Brand B"
}
all { applicationIdSuffix ".${it.name.toLowerCase()}" }
}
buildTypes {
debug
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation project(':common-dependencies')
implementation project(':component')
brandAImplementation project(':city-picker')
brandAImplementation project(':profile')
brandAImplementation project(':matches')
brandAImplementation project(':chat')
brandBImplementation project(':city-picker')
brandBImplementation project(':chat')
compileOnly 'com.google.auto.service:auto-service:1.0-rc3'
kapt "com.google.auto.service:auto-service:1.0-rc3"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
mavenCentral()
}
, 그러나 kapt
은 기본적으로 해당 파일을 생성하지 않습니다. Java 클래스를 사용하면 즉시 생성됩니다. 그 이유는 무엇입니까?
불행히도 작동하지 않았습니다. : – user3605025
이것은 더 이상 사용되지 않으며 Kotlin 1.2 출시 직후에 제거 될 원래의 kapt 용입니다 – yanex