Android Tutorial Create an aar archive from a third party library

DonManfred

Expert
Licensed 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



and extract the files




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



We use the Path from the files we just have extracted



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



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"



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



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



RUN this build....

Hopefully we see something like



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

Right-Click again and use Show in Explorer





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



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.



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



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



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


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



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




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



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



Add the jar with the add jar function





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