Open yinanwang1 opened 2 months ago
我的鸿蒙也出现了 Caused by: java.lang.ClassNotFoundException: Didn't find class "android.window.BackEvent" on path: DexPathList 机型mate40 系统harmonyos 4.0.0
There are multiple issues about this, do none of the solutions there work?
There are multiple issues about this, do none of the solutions there work?
Thank you for your replay. YES, I don't find any solution to fix this bug in the ISSUES. THE error message is: Didn't find class "android.window.BackEvent". There is no same issues.
WHAT information about this bug do you want, I can offer?
My CODE as follow:
class JourneyFinishActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (!EventBus.getDefault().isRegistered(this) && findBackEvent()) {
EventBus.getDefault().register(this)
}
}
Especially, invoke the EventBus.getDefault().register(this)
in the FlutterActivity file, it crashes. I don't know the reason is caused by the flutter activity or not!
I hope this is helpful and I look forward to hearing from you.
Good luck.
Please look at the issues I have linked. They are relevant to your issue which is a ClassNotFoundException
. I don't have time to summarize them all here.
增加一个冗余类 临时解决
Translation: Add a redundant class as a temporary solution
class _SplashFlutterActivityEventReceiver(val activity: SplashFlutterActivity) {
fun register() {
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this)
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onFlutterEvent(event: FlutterSendEventBean) {
...
}
fun unRegister() {
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this)
}
}
}
open class SplashFlutterActivity : FlutterBoostActivity() {
val _eventReceiver = _SplashFlutterActivityEventReceiver(this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
_eventReceiver.register()
...
}
override fun onDestroy() {
super.onDestroy()
_eventReceiver.unRegister()
...
}
I had the same crash in my Flutter activity and temporarily fixed it with @mainlxl 's logic. Thank you!
Edit: updated to translate to English, as this issue tracker is in English.
鸿蒙系统注册时崩溃 Translation: Hongmeng system crashes during registration
崩溃执行的代码为
EventBus.getDefault().register(this)
在注册的时候就崩溃了。崩溃的日志如下: Translation: The code executed by the crash isEventBus.getDefault().register(this)
and it crashes when registering. The crash log is as follows: