0

While launching my application the event bus service gives an error for

 java.lang.NoClassDefFoundError: android/app/assist/AssistContent
    at java.lang.Class.getDeclaredMethods(Native Method)
    at java.lang.Class.getPublicMethodsRecursive(Class.java:894)
    at java.lang.Class.getMethods(Class.java:877)
    at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingReflectionInSingleClass(SubscriberMethodFinder.java:157)
    at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingInfo(SubscriberMethodFinder.java:88)
    at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:64)
    at org.greenrobot.eventbus.EventBus.register(EventBus.java:136)
    at com.sharefile.mvvm.services.eventBus.EventBusService.register(EventBusService.java:33)

if I am consuming the public api

@TargetApi(23)
    public final void onProvideAssistContent(AssistContent var1) {
    //  some stuff
    }

for Pre Marshmallow devices, I have tried the http://greenrobot.org/eventbus/documentation/faq/ link even with subscriber-index.

Tarun Goel
  • 36
  • 4
  • Read about [MultiDex](https://developer.android.com/reference/android/support/multidex/MultiDex.html). I have the same error when I tried to use extrenal library in my project. – matejko219 Sep 12 '16 at 14:41
  • Thanks @matejko, I have already have the following code in my app, protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(base); } Even if I remove this and try to derive for MultiDexApplication it doesn't works, How did you solved the issue by enabling or disabling multi dex. For me since its working fine on marshmallow I am thinking it could be an issue as the api is exposed is only for marshmallow may be event bus is supports to ignore it if running in devices lower than marshmallow and then crashes. – Tarun Goel Sep 12 '16 at 15:38
  • I get the same error if I use any 23 api like public final boolean onSearchRequested(SearchEvent var1) { return true; } I get the same error – Tarun Goel Sep 12 '16 at 17:38
  • I just upgrade min sdk version because I started project for Android ICS but I don't really need support for this version. – matejko219 Sep 12 '16 at 19:48
  • I think I have figured out the issue, in my app I have a abstract class that is deriving the activity and having the new api of 23, There is my activity which is deriving the abstract class and have @Subscribe methods. So while registering for event bus the code looks like when getting the methods for the derived class it tries to get method of base class too and fallback to reflection and hence fails. – Tarun Goel Sep 12 '16 at 23:43
  • Great job :). If it totally solved your issue edit your post and add your solution. It can help other people. – matejko219 Sep 13 '16 at 06:13
  • Not solved it totally, have logged a bug with green robot, https://github.com/greenrobot/EventBus/issues/351 waiting for their reply – Tarun Goel Sep 13 '16 at 13:59

0 Answers0