Zhen Liu
Zhen Liu

Reputation: 7932

Eventbus index doesn't get generated on Android

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'
    }
}

Upvotes: 1

Views: 1173

Answers (2)

Jere Chen
Jere Chen

Reputation: 71

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.

Upvotes: 1

zwh
zwh

Reputation: 192

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

Upvotes: 5

Related Questions