NativeScript / NativeScript/android
Implementing native android .aar file or .aidl in Nativescript throws native calss object without access to methods
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ả
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI:
- Cross-platform modules:
- Android Runtime:
- iOS Runtime:
- Plugin(s):
Android
Describe the bug
I have an Android SDk done with java whic I already converted to .aar file. I created a plugin and placed the aar file in App_Resources/Android/libs directory. In my index.js file, I have this
var intent = new android.content.Intent(application.android.foregroundActivity, com.iposprinter.printertestdemo.IPosPrinterTestDemo.class)
intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
application.android.foregroundActivity.startActivity(intent);
This cause the sdk to display.
Doing this
var iposprinter=new com.iposprinter.printertestdemo.IPosPrinterTestDemo()
console.log(iposprinter) //outputs com.iposprinter.printertestdemo.IPosPrinterTestDemo@682890e
while this `console.log(iposprinter.printerInit) outputs undefined`
while this
`console.log(iposprinter.printerInit) outputs undefined`
console.log(iposprinter.printerInit()) outputs undefined
TypeError: iposprinter.printerInit is not a function
How do I call methods from this package?
To Reproduce
Expected behavior
Sample project
Additional context
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 index.js của plugin và vị trí đặt .aar trong App_Resources/Android/libs, sau đó tái hiện các log native object và printerInit từ issue. Kiểm tra cách Android runtime cung cấp Java class đã được đóng gói; được xem là hoàn tất khi các phương thức SDK khả dụng và có thể được gọi mà không gặp TypeError.
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- 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