NativeScript / NativeScript/android
Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' - from Retrofit generating implementations from interfaces
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 563
- Fork
- 144
- Merge trung bình
- 10 giờ 46 phút
- Pull request đã merge (30 ngày)
- 14
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với lời gọi bị lỗi trong spotify-api/src/main/java/kaaes/spotify/webapi/android/SpotifyApi.java, khoảng dòng 69, và các vị trí trong stack trace ở Runtime.java, khoảng dòng 426 và 403. Xem lại pull request 501 của android-runtime được liên kết để xác định liệu nó có xử lý các triển khai được tạo từ interface hay không; công việc được xem là hoàn tất khi xác nhận rằng restAdapter.create(SpotifyService.class) hoạt động hoặc ghi lại rằng tính năng này vẫn chưa được hỗ trợ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, java
- Lĩnh vực
- mobile-dev
- Loại issue
- Lỗi
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100