Android 上未生成 Eventbus 索引
Eventbus index doesn't get generated on Android
我尝试按照
中的步骤操作
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'
}
}
在build.gradle中添加配置后,点击Build->Make,然后会生成MyEventBusIndex。
今天尝试生成MyEventBusIndex class,我失败了。我发现如果我的项目中没有@Subscribe函数(我创建新项目来测试EventBus索引) ,MyEventBusIndex class不会生成,但我尝试添加@Subscribe函数和重建项目,然后检查目录'app/build/generated/source/..',我生成 MyEventBusIndex。
我尝试按照
中的步骤操作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'
}
}
在build.gradle中添加配置后,点击Build->Make,然后会生成MyEventBusIndex。
今天尝试生成MyEventBusIndex class,我失败了。我发现如果我的项目中没有@Subscribe函数(我创建新项目来测试EventBus索引) ,MyEventBusIndex class不会生成,但我尝试添加@Subscribe函数和重建项目,然后检查目录'app/build/generated/source/..',我生成 MyEventBusIndex。