NativeScript / NativeScript/android
Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' - from Retrofit generating implementations from interfaces
Personne n'a encore pris cette issue.
- Langage dominant
- C++
- Étoiles
- 563
- Forks
- 144
- Merge moyen
- 10 h 46 min
- PR mergées (30 j)
- 14
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l'appel en échec dans spotify-api/src/main/java/kaaes/spotify/webapi/android/SpotifyApi.java vers la ligne 69 et par les emplacements de la stack trace dans Runtime.java vers les lignes 426 et 403. Examinez la pull request 501 liée de android-runtime afin de déterminer si elle prend en charge les implémentations générées à partir d'interfaces ; le travail serait considéré comme terminé s'il est confirmé que restAdapter.create(SpotifyService.class) fonctionne ou s'il est documenté que cela reste non pris en charge.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, java
- Domaine
- mobile-dev
- Type d'issue
- Bug
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100