NativeScript / NativeScript/android

Implementing native android .aar file or .aidl in Nativescript throws native calss object without access to methods

オープン
#1,535 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C++
スター
563
フォーク
144
平均マージ
10時間 46分
マージ済み PR(30日)
14

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まずプラグインの index.js と App_Resources/Android/libs 配下の .aar の配置を確認し、その後、issue にある native object と printerInit のログを再現してください。Android ランタイムがパッケージ化された Java クラスをどのように公開しているかを確認します。SDK のメソッドが利用可能で、TypeError なしに呼び出せれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, java
領域
mobile-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。