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