JessYanCoding / MVPArms

⚔️ A common architecture for Android applications developing based on MVP, integrates many open source projects, to make your developing quicker and easier (一个整合了大量主流开源项目高度可配置化的 Android MVP 快速集成框架).
Apache License 2.0
10.28k stars 2.39k forks source link

使用kotlin dagger的注解会失效,报kotlin的类找不到 #291

Closed Vegen closed 5 years ago

Vegen commented 5 years ago

例如

@FragmentScope
@Component(modules = [TestModule::class])
interface TestComponent {
    fun inject(fragment: TestFragment)
}

要是 TestModule 是用 kotlin 写的就会报找不到 TestModule这个类

TestModule 里的 TestContract要是用kotlin写, 也会报找不到 TestContract

另附 gradle 配置

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

.....省略

api rootProject.ext.dependencies["dagger2"]
kapt rootProject.ext.dependencies["dagger2-compiler"]
Vegen commented 5 years ago

app的gradle也要写 kapt rootProject.ext.dependencies["dagger2-compiler"]! 终于解决了