NativeScript / NativeScript/android
Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' - from Retrofit generating implementations from interfaces
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 563
- 派生
- 144
- 平均合并
- 10 小时 46 分钟
- 30 天内合并 PR
- 14
描述
Curious if this is currently supported. I have tried many different things but none seem to work.
The issue seems to stem from the fact that the Retrofit (http://square.github.io/retrofit/) library generates implementations from interfaces and relies on the ability to take say an interface file (for example):
public interface SpotifyService {...
And generate an implementation by doing this restAdapter.create(SpotifyService.class) which crashes immediately with:
com.tns.NativeScriptException:
Error: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' on a null object reference
com.tns.Runtime.getTypeMetadata(Runtime.java:426)
com.tns.Runtime.getTypeMetadata(Runtime.java:403)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:861)
com.tns.Runtime.callJSMethodImpl(Runtime.java:726)
com.tns.Runtime.callJSMethod(Runtime.java:712)
com.tns.Runtime.callJSMethod(Runtime.java:693)
com.tns.Runtime.callJSMethod(Runtime.java:683)
The library I'm trying to use does this here:
https://github.com/kaaes/spotify-web-api-android/blob/master/spotify-api/src/main/java/kaaes/spotify/webapi/android/SpotifyApi.java#L69
Is there a way to make this work currently or is support for this planned and if so, it would be much appreciated to know approximately when?
UPDATE:
I found this https://github.com/NativeScript/android-runtime/pull/501, curious if it's related and if that PR which is now merged will make something like the above possible with 2.2.0?
/cc @bradmartin
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 spotify-api/src/main/java/kaaes/spotify/webapi/android/SpotifyApi.java 中大约第 69 行的失败调用,以及 Runtime.java 中大约第 426 行和第 403 行的堆栈跟踪位置开始。检查链接的 android-runtime pull request 501,以确定它是否处理接口生成的实现;完成此项需要确认 restAdapter.create(SpotifyService.class) 是否可用,或者记录说明它仍不受支持。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, java
- 领域
- mobile-dev
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100