Nativescript: Android with java file

Created on 25 Sep 2018  路  4Comments  路  Source: NativeScript/NativeScript

I use [email protected] and I wanna know how can I add a .java file in my nativescript project.

I use nativescript@4.+

android

Most helpful comment

I found the solution !
Just adding your java files in "your_project\app\App_Resources\Android\src\main\java"
then call the class in your js or ts file and Nativescript will take care to send you back your object.
nativescript is the simplest, just understand the logic.
Nativescript is the best

All 4 comments

At this very moment, a viable option is to create an Android library from your java file.

The possibility to directly use java files in NativeScript is logged as a feature here

I found the solution !
Just adding your java files in "your_project\app\App_Resources\Android\src\main\java"
then call the class in your js or ts file and Nativescript will take care to send you back your object.
nativescript is the simplest, just understand the logic.
Nativescript is the best

@Fabiyo-90 can you post an example app? This does not seem to work for me. Thanks

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhanalakshmitawwa picture dhanalakshmitawwa  路  3Comments

nirsalon picture nirsalon  路  3Comments

OscarLopezArnaiz picture OscarLopezArnaiz  路  3Comments

valentinstoychev picture valentinstoychev  路  3Comments

NordlingDev picture NordlingDev  路  3Comments