NativeScript / NativeScript/android

Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' - from Retrofit generating implementations from interfaces

オープン
#528 コメント 13 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
C++
スター
563
フォーク
144
平均マージ
10時間 46分
マージ済み PR(30日)
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. 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
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。