Import .aar file and use it with NS


#1

Hello, I’ve been struggling with this and spend more than a day now trying to figure how to solve this. I must do it with NS and I’ve no experience in JS or whatosever so I’m doing it with Angular + TS, I need someone that could help me out “step by step” with this.

  • I have a project called NSDemo with NS 4.0 and Angular+TS.
  • I have an Android 3rd party library (.aar file which I need to include and use it in my NS application) called myLib.aar.
  • I’ve placed it on the app/AppResources/Android/lib and when I run tns build android I can see that it gets added without any problem, the thing here is HOW and WHERE can I use it? (If I’m able to do it without a plugin it would be good, because that’s an extra step).
  • For examples purposes let’s say I’ve the class MyClass() in the library and I want to use it and call methods from it, how can I do so in a ts file from my NS app?

Thank you so much!


#2

Once the aar file is added, at runtime you can just access it by it’s name with package name, for example com.package.MyClass.