Android Tutorial Create an aar archive from a third party library

DonManfred

Expert
Licensed User
Longtime User
I want to try to decribe the way you need to go to create an aar out from an third party lib to later user this aar in b4a and in the - still needed wrapper.
Maybe the aar is useable without a wrapper around it but i´m not familar working with javaobject

Ok. Let´s start...

A few days ago i saw this lib on github
https://github.com/Thereisnospon/CodeView

I have not tried to do a wrap for this in the past. So i dont know if all works. We´ll know at the end :D

Download the Library
makingofaar0021.png



and extract the files

makingofaar0022.png



Now we start Android Studio and use the import function of Android Studio

makingofaar0023.png


We use the Path from the files we just have extracted

makingofaar0024.png


Android Studio now will import/create/update (whatever Android Studio may do :D) the project to import it into the Workspace.

Android Studio wants to change something. I tell him ok, do it and click on UPDATE

makingofaar0025.png


Android Studio will do the things it wants to do in this step (honestly; I DONT KNOW)

But then the project is loaded in Android Studio

Let´s open the "GradleScripts"

makingofaar0027.png


The Build which is interesting for us is the "Module codeview"

makingofaar0028.png


Right-Click on this build to get the context popup shown...

makingofaar0029.png


RUN this build....

Hopefully we see something like

makingofaar0030.png


So i guess the build is correctly done. Let´s VERIFY that

Right-Click again and use Show in Explorer

makingofaar0031.png


makingofaar0032.png


We now look into the build folder we see
More exactly we look into the folder build\outputs\aar\

makingofaar0033.png


That´s the file we want!

We copy this file to a save place and maybe give it another name.

For this we´ll name it codeview.aar and copy it.

makingofaar0034.png


The AAR file is build! But to use it later in B4A we still need to write a wrapper for this view.
But now we are using the content of the aar to reference the sources inside it.

We rename codeview.aar to codeview.aar.zip and extracting the file classes.jar from this zip

makingofaar0035.png


Now i will start a new Wrapperproject in Eclipse. For this i use my base Template

makingofaar0036.png


Make a copy of this folder to create a new copy of it...
makingofaar0037.png


and rename it to have a correct name for the library we want to write.

makingofaar0038.png


we now go inside the Folder CodeView\libs\ and we copy the classes.jar to the libs folder.


makingofaar0039.png


We now import this project in eclipse and we can start configuring it

makingofaar0040.png


Rightclick on the Project to go into the Build Paths settings...

makingofaar0041.png


Add the jar with the add jar function

makingofaar0042.png


makingofaar0043.png


We now have the reference set to start the wrap...

From here we now need to do the same as for any other wrapper. Writing a code for an ViewWrapper or an AbsObjectWrapper.

Basically this is now the same work as described in other Tutorials on how to write a wrapper for b4a.

This tutorial will end here. I hope i described it clearly enough to understand and i hope you´ll manage this by yourself in future with this help. Good luck ;-)

Thank you for reading
 
Last edited:
Top