Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#1,535 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
android, java
Bereich
mobile-dev

Rechercherichtung

Beginne mit der index.js des Plugins und der Platzierung der .aar-Datei unter App_Resources/Android/libs und reproduziere anschließend die native object- und printerInit-Logs aus dem Issue. Prüfe, wie die Android-Laufzeit die paketierte Java-Klasse bereitstellt; abgeschlossen ist die Aufgabe, wenn die SDK-Methoden verfügbar sind und ohne den TypeError aufgerufen werden können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
C++
Sterne
563
Forks
144
Ø Merge
10 Std. 46 Min.
Gemergte PRs (30 T.)
14

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus NativeScript/android

Alle Issues in NativeScript/android

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.