事件总线索引不会在Android上生成

时间:2018-03-13 16:29:26

标签: android greenrobot-eventbus

我尝试按照

中的步骤操作

http://greenrobot.org/eventbus/documentation/subscriber-index/

但由于某种原因,MyeventBusIndex根本就没有生成!

有什么理由说明为什么会这样吗?

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "my.application.id"
        minSdkVersion 18
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true
                arguments = [ eventBusIndex : 'com.example.myapp.MyEventBusIndex' ]
            }
        }
    }
}

dependencies {
    compile 'org.greenrobot:eventbus:3.1.1'
    annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.1.1'

}

我有gradle 3.0.1

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

1 个答案:

答案 0 :(得分:1)

在build.gradle中添加该配置后,单击 Build-> Make ,然后将生成 MyEventBusIndex