Skip to content

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

Open
@NathanWalker

Description

@NathanWalker

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 #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions