NativeScript / NativeScript/android
Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' - from Retrofit generating implementations from interfaces
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- C++
- Estrelas
- 563
- Forks
- 144
- Merge médio
- 10h 46min
- PRs com merge (30d)
- 14
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece pela chamada que falha em spotify-api/src/main/java/kaaes/spotify/webapi/android/SpotifyApi.java por volta da linha 69 e pelas localizações do stack trace em Runtime.java por volta das linhas 426 e 403. Revise o pull request 501 vinculado do android-runtime para determinar se ele trata de implementações geradas por interfaces; o trabalho estará concluído quando for confirmado que restAdapter.create(SpotifyService.class) funciona ou quando for documentado que isso continua sem suporte.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- android, java
- Domínio
- mobile-dev
- Tipo de issue
- Bug
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100