How to use *.jar file in native script

plugins

#1

I have a third party .jar file(for printing) built in JAVA and I want to include that .jar file in ‘angular 5 + Native Script’ project and use that .jar file classes in Native Script Project. where to and how to place that .jar file in angular5native script


#2

Just place the jar file inside app/App_Resources/android folder and rebuild your project.
The classes of that jar file will be available to your nativescript app.

Another way would be to build a plugin that uses that jar file.


#3

Thanks for the help. I am new to native script. can you just tell me how to rebuild the project


#4

use the cli command for building:
$ tns build android


#5

thank you @jpedraza. I imported the package like this.

const leopardPkg = com.leopard.api;

Now I am getting the error like cannot find the name com . can you tell me how to import the package correctly.


#6

these articles can help you:

https://docs.nativescript.org/runtimes/android/plugins/plugins


#7

with out creating the package can’t we directly import the *.jar file in the angular component