How do I use .aar in my component?

Hello community I'm building a component that uses a .aar library. How can I do that ? I know how to use .jar in a component. Sorry for my english.

1 Like

.aar libraries are currently not supported. However, there is a hacky way to get them working. TLDR is extracting the classes.jar from the aar and including both files in the locations where you would add your jar file

Maybe my old thread helps you
https://groups.google.com/forum/#!searchin/app-inventor-open-source-dev/aar|sort:date/app-inventor-open-source-dev/wG2tja-ZMvc/I6MQ_pvdAgAJ

Thanks @Red_Panda sir for your reply.

I’m trying to build a component. I read the thread and below line of @ewpatton sir, it seems like its possible for built-in component. I don’t have much experience please correct me if I’m wrong.

Yes,you can use aar library .

Can you please describe how can I do it ? it would be very helpful.

You can see this https://github.com/mit-cml/appinventor-sources/blob/master/appinventor/components/build.xml before line 173

Thanks @kangris I got it.

1 Like

Note that AAR support for extensions is pretty limited. You can use the classes.jar from within the .aar, but resources in the aar don’t come along with the extension. If the jar file makes use of resources, then the app may crash when it tries to load the unavailable resources.

5 Likes

Ok sir I undurstand. thanks for your help.

Does that mean, aar dependencies do not work? Can I import them manually?

They only don’t work in extensions. If you are building a whole copy of App Inventor, you can use aar files. You just need to extract the classes.jar file from it and reference both the .jar and .aar in the @UsesLibraries annotation. The problem with extensions is that the code that produces the extension doesn’t know how to properly handle .aar dependencies, so it fails to pull in everything that would be needed and the buildserver doesn’t know how to process aix files containing aars. It’s an unowned project if anyone would like to contribute it to the open source repo.

4 Likes

Do we can expect that aar support will be added on the extension on next update of AppInventor in future ??
@ewpatton

1 Like

Actually, there was a Pull request by the great @Jarlissonlira2

But mit devs didn't implemented it yet
:frowning:

3 Likes