Android Question Import aar class

LuigiTasca

Member
Licensed User
Longtime User
Hi,
I neet to import a third part class into my b4a project.
I read in the forum that I can import a jar class and run methods with javaObjects.

The problem is that they gave me a aar class.

These are my questions:

1) Can I extract the jar file and xml from aar without problems? How? can I simply extract them? Or can I import simply the aar class?
Or can I import simply the aar class?

2)What's the exact name that I have to insert to "#AdditionalJar:[?]". Where I can find it?

3)In "jo.InitializeStatic("[?]")" Have I to insert the path inside the xml file?

I don't know how to do that.

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

LuigiTasca

Member
Licensed User
Longtime User
@DonManfred @Erel
I think that b4a search for the corrispective library .xml... (ex. in additional libreries folder I add mylib.jar and mylib.xml )... But I don't know how to do with aar.
I hope I'm making myself clear.
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
You can add a reference to the aar package with:
B4X:
#AdditionalJar: YourAAR.aar

Don't add it as a library. Put this code at the top of your main activity but give the full path of the .aar file which should probably be in a place other than your other (.jar/.xml) libraries.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

LuigiTasca

Member
Licensed User
Longtime User
Tank you for your help.
I have been able to make some progress in importing the aar library into a B4A project

I am able to run a method inside the library called 'getInstance' with no error..

Dim jo As JavaObject
jo.InitializeStatic("it.getyourbill.gybservice.InitService").RunMethod("getInstance", Array(GetContext))

But if I run another method called 'init'
jo.RunMethod("init", Null)

I get the following error:
java.lang.NoClassDefFoundError: it.getyourbill.gybservice.R$string

Inside the aar there is a resource folder called res\values that contains a file called values.xml with strings definitions.
What could be the problem.
Your help is very much appreciated.
Thank you.
 
Upvote 0
Top