版本 3.3.3 内存泄露解决方案

作者: zhaobinsir创建于 2026年9月15日更新于 2026年9月15日

Solution: Call the onDestroy function in the BaseActivity or ordinary Activity. try { val immersionBar = ImmersionBar.with(this) val destroyMethod = immersionBar.javaClass.getDeclaredMethod("onDestroy") destroyMethod.isAccessible = true destroyMethod.invoke(immersionBar) } catch (e: Exception) { e.printStackTrace() } Note: Please remember not to use ImmersionBar.with(this).xxx in the splash screen, the life cycle of the splash screen is very fast, and the internal Fragment of the SDK cannot receive the corresponding life cycle callback (onDestroy) in time, which may cause memory leaks. It is recommended that authors release some private functions (release the functions related to listening).

内容来源: gyf-dev/ImmersionBar