IllegalAccessError: Method is inaccessible to class

前端 未结 3 1817
耶瑟儿~
耶瑟儿~ 2021-02-10 02:09

I\'ve got very strange error, because it only happens after installing app from generated .apk. When I try to run the app through IDE, it works fine.



        
3条回答
  •  梦如初夏
    2021-02-10 03:10

    While I'm not sure why this results in IllegalAccessError, you should be defining those constants like this:

    companion object {
        const val ANIMATION_DEFAULT = 0
        const val ANIMATION_SLIDE_FROM_RIGHT = 1
        const val ANIMATION_SLIDE_FROM_BOTTOM = 2
    }
    

    And that should solve your problem, otherwise using @JvmField instead of @JvmStatic would have been a better choice.

提交回复
热议问题