Skip to content

Android 在 Dev 模式下 reload 后 componentName 为 null #4411

@situ2001

Description

@situ2001

期望结果

如题,不知道是否正常。

背景

public boolean onInterceptCallNative(@NonNull String componentName,

这里虽然有标注 @NonNull ,但在 Dev 模式下 reload 后, componentName 变为 null

这会导致开发者在写 kt 的时候没有处理 null 的情况,从而导致 NPE,如下

 override fun onInterceptCallNative(p0: String, p1: HippyCallNativeParams): Boolean {
     return false
 }

目前改为这样以规避问题,但理论上不该出现 componentNamenull 的情况

 override fun onInterceptCallNative(p0: String?, p1: HippyCallNativeParams): Boolean {
     return false
 }

实际结果

理论上不该出现 componentNamenull 的情况

重现链接

No response

重现步骤

  1. 用 kt 实现 HippyEngineMonitorAdapter 并标注 onInterceptCallNative 的第一个参数类型为 String
  2. 指定该 Adapter 为 engineMonitor
  3. 进入 Dev 模式
  4. 通过屏幕左上方悬浮点进行 reload
  5. 预期将会看到 Hippy 黑屏

重现环境

No response

补充说明

如需更多信息,企微联系 routersitu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions