1

I tried to follow the steps in

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

but for some reason the MyeventBusIndex simply doesn't get generated!

Are there any reasons why that is the case for me??

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'

}

I have gradle 3.0.1

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}
Zhen Liu
  • 7,550
  • 14
  • 53
  • 96

2 Answers2

5

After adding that configs in build.gradle, click Build->Make then MyEventBusIndex will be generated.

zwh
  • 172
  • 2
  • 12
1

Today try to generate the MyEventBusIndex class, I failed。I found if no @Subscribe function in my project(I create new project to test EventBus index), the MyEventBusIndex class will not generate,but I try to add the @Subscribe function and rebuild the project, then check the directory 'app/build/generated/source/..’, i generate the MyEventBusIndex.

Jere Chen
  • 71
  • 1
  • 3