I've wrestled with this for the past couple of hours or so, but cannot get gradle to build my index. I get the following error:
warning: The following options were not recognized by any processor: '[eventBusIndex]'
Here are snippets of my build.gradle file. I also have apt working for dagger 2.0, so I know my apt configuration works:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
}
}
repositories {
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
dependencies {
compile 'org.greenrobot:eventbus:3.0.0'
apt 'org.greenrobot:eventbus-annotation-processor:3.0.1'
}
apt {
arguments {
eventBusIndex "com.example.EventBusAppIndex"
}
}
Any pointers on what I may be missing?
Thanks a lot for a fantastic library btw. I've used 2.x version extensively in past projects
i have the same error
i have the same error, too
Could you try to narrow this down? E.g. remove retrolambda? Did you try to disable any other annotation processors?
My error is can not find index class:
project gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
allprojects {
repositories {
jcenter()
}
}
module gradle:
apply plugin: 'com.android.application'
// apply plugin: 'com.android.databinding'
android {
compileSdkVersion 22
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.onfengma.androidprac"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apply plugin: 'com.neenbedankt.android-apt'
apt {
arguments {
eventBusIndex "com.onfengma.androidprac.MyEventBusIndex"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':sdk')
compile 'org.greenrobot:eventbus:3.0.0'
apt 'org.greenrobot:eventbus-annotation-processor:3.0.1'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:palette-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'me.imid.swipebacklayout.lib:library:1.0.0'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.facebook.stetho:stetho:1.1.1'
compile 'com.facebook.stetho:stetho-okhttp:1.1.1'
compile 'com.facebook.stetho:stetho-urlconnection:1.1.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.android.support:gridlayout-v7:23.1.0'
}
MainApplication:
public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Stetho.initialize(
// Stetho.newInitializerBuilder(this)
// .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
// .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
// .build());
EventBus.builder().addIndex(new MyEventBusIndex()).installDefaultEventBus();
}
}
And MyEventBusIndex not exist at bulid time and show :
warning: The following options were not recognized by any processor: '[eventBusIndex]'
Finally, I find the reason.
It must have at least one @Subscribe method
such as : `
@Subscribe
public void onEvent(Event event) {}
then build error gone
Thanks @chufengma that fixed it for me also. Currently bootstrapping a new project and don't have any functionality in. Stubbed this in and got the index built.
Added a hint to http://greenrobot.org/eventbus/documentation/faq/ - Thanks!
i have added all subscribe annotation at onEvent method, but i still see this warning.
it is not an error so that i can continue the building.
I have this problem, but for androidTest builds. There are definitely subscribers in the app code, however none in the androidTest code. Any ideas?
how to release?
I added @Subscribe annotations to all my onEventMaintThread events, but I am getting this warning. Any help?
@chufengma thank you!
Most helpful comment
Finally, I find the reason.
It must have at least one
@Subscribe method
such as : `then build error gone