NativeScript / NativeScript/android

wrong native method signature called.

未关闭
#1,645 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C++
星标
563
派生
144
平均合并
10 小时 46 分钟
30 天内合并 PR
14

描述

I found an issue with runtime which actually calls the wrong method on android.
this the method
https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.GpsStatus.NmeaListener)
That method changed in 24 and now use that signature https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener)
The issue is that in both cases the parameter is actually a java.lang.Object. And the runtime actually always chooses this one even on pre 24 => crash.
We discovered that issue in my gps plugin here and the actual crash happens here https://github.com/nativescript-community/gps/blob/b3fe1d032cb3e5b6f7b76f1cf62926fdab6d0baa/src/gps.android.ts#L456

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 gps.android.ts 中引用的位置开始,尤其是第 83 行和第 456 行,以复现 runtime 调用 LocationManager.addNmeaListener 的方式。然后跟踪 Android 原生的方法选择代码,并验证 pre-24 和 24+ 使用适当的签名且不会发生崩溃。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, cpp
领域
mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。