Dev/Android

[Android] EventBus 를 사용하면서 만나는 오류

healthyryu 2016. 2. 16. 21:50

Android 에서 Greenrobot의 EventBus를 사용중.

현재, Intro 작업과 Login 작업중인데, EventBus 를 사용할때 주의할 점이 있습니다. EventBus 는 등록만 하고 @Subscribe 를 사용해서 받을 곳을 이벤트를 구독할 곳을 정해놓지 않을경우 빌드하고나면 오류가 발생합니다.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
02-16 21:33:45.989  13965-13965/com.humane.smps2.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.humane.smps2.app, PID: 13965
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.humane.smps2.app/com.humane.app.activity.LoginActivity}: de.greenrobot.event.EventBusException: Subscriber class com.humane.app.activity.LoginActivity and its super classes have no public methods with the @Subscribe annotation
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2318)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:149)
            at android.app.ActivityThread.main(ActivityThread.java:5257)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: de.greenrobot.event.EventBusException: Subscriber class com.humane.app.activity.LoginActivity and its super classes have no public methods with the @Subscribe annotation
            at de.greenrobot.event.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:82)
            at de.greenrobot.event.EventBus.register(EventBus.java:135)
            at com.humane.app.activity.LoginActivity.onCreate(LoginActivity.java:22)
            at android.app.Activity.performCreate(Activity.java:5411)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:149)
            at android.app.ActivityThread.main(ActivityThread.java:5257)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
            at dalvik.system.NativeStart.main(Native Method)
02-16 21:38:46.039  13965-13965/com.humane.smps2.app I/Process﹕ Sending signal. PID: 13965 SIG: 9
cs



중국 개발자인듯 한데, 이사람도 Subscribe 를 적용하지 않았을 경우 오류가 생겼음을 보이고 있습니다.

http://chenfuduo.me/2015/07/10/EventBus%E4%BD%BF%E7%94%A8%E6%A1%88%E4%BE%8B%E5%92%8C%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/



#Android, #EventBus



반응형