它的超级 类 没有 public 带有 Kotlin 和 DI 注释的 @Subscribe 方法

and its super classes have no public methods with the @Subscribe annotation with Kotlin and DI

我已经检查了堆栈中的所有答案。但没有任何帮助。可能是 Kotlin + DI 中的问题

所以我得到一个异常,Eventbus 由于某种原因无法在演示者中初始化自己 class。通过调试器,我看到初始化方法从 onCreate 以正确的方式执行。我使用的代码与我在其他 classes (Java classes) 中使用的代码相同,其他代码工作正常。你能给个建议吗?哪里可能有问题

错误

Caused by: org.greenrobot.eventbus.EventBusException: Subscriber class com.myapp.mvp.ui.myprofile.MyProfileActivity and its super classes have no public methods with the @Subscribe annotation
    at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:67)
    at org.greenrobot.eventbus.EventBus.register(EventBus.java:140)
    at com.myapp.mvp.ui.myprofile.MyProfileActivity.onCreate(MyProfileActivity.kt:67)
    at android.app.Activity.performCreate(Activity.java:7981)
    at android.app.Activity.performCreate(Activity.java:7970)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)

我的主持人class

import com.arellomobile.mvp.InjectViewState
import com.arellomobile.mvp.MvpPresenter
import com.myapp.UserProfileItemsList
import com.myapp.eventbus.VisitsEvent
import com.myapp.eventbus.UserEvent
import com.myapp.models.UserDescriptionModel
import com.myapp.mvp.model.interactor.myprofile.MyProfileInteractor
import com.myapp.utils.ActionsCountInfoCallback
import com.myapp.utils.UserCallback
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe

import java.util.ArrayList
import javax.inject.Inject

@InjectViewState
class MyProfilePresenter @Inject constructor(private val interactor: MyProfileInteractor) : MvpPresenter<MyProfileView>() {
    private val userDescriptionList = ArrayList<UserDescriptionModel>()

    override fun onFirstViewAttach() {
        super.onFirstViewAttach()
        setAllCurrentUserInfo()
        setActionsCount()
    }

    fun setAllCurrentUserInfo() {
        interactor.getAllCurrentUserInfo(UserCallback{ fsUser ->
            viewState.setUserData(fsUser.name, fsUser.age, fsUser.country, fsUser.image)
            userDescriptionList.addAll(UserProfileItemsList.initData(fsUser))
            viewState.setList(userDescriptionList)
            EventBus.getDefault().post(UserEvent(fsUser))
        })
    }

    private fun setActionsCount() {
        interactor.getActionsCountInfo(
                ActionsCountInfoCallback{ visits, likes -> viewState.setActionsCount(visits, likes) })
    }

    @Subscribe
    private fun updateActionsCount(event: VisitsEvent){
        viewState.setActionsCount(event.getmVisits(), event.getmLikes())
    }


    fun registerSubscribers() {
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this)
        }
    }

    fun unsubscribe(){
        EventBus.getDefault().unregister(this)
    }

}

MyProfileActivity and its super classes have no public methods with the @Subscribe annotation

强调我的。从此处的函数中删除 private

@Subscribe
private fun updateActionsCount(event: VisitsEvent)