Android so File Usage Question


I was just curious if someone could give me a quick once over on how to setup Android Studio to use my newly built native libraries. I can get the libraries to build no problem and I have the .so files but, I’m not 100% sure how to use the .so files in Android Studio. I tried to mock the setup of the Sample code but I must be missing something. Do I have to build a jar/aar out of the .so files or can I use them alone? Or do I import them as a module somehow? A quick step by step would be amazing!

I am running Ubuntu if that makes the steps any different


For anyone else having issues I learned a few things in the process of getting this setup:

1 - You must use NDK version 14. The latest version removed some functionality that the make files need and it breaks the so files causing crashes after you import and try to use them

2 - When you run build sdk it does NOT build the samples. You can run the build samples build script and use the aar files output in the gradle folder. Import these aar files and add them to your project and then the errors around your imports not being able to find the libs

I’m guessing you can also get the ARSDK3 project working, only have to add that single dependency to your project and be good to go but, for me this was not working and giving me all sorts of errors so I just imported each library’s aar as a module in my project, copied the .so files into my src/main/jniLibs folder and added the System.loadLibrary(‘so lib name’) calls that are found in the one static method in the ARSDK3 project to my main activity and bam, all worked without any crashes or bitching about not being able to find methods in my so files


Sorry for my late answer.

Do you have any particular needs or do you just want to import ARSDK libs into your project?
If you only need to use the SDK in an Android project, I suggest you to read the documentation.

In short:

  • add to your app build.gradle file: compile 'com.parrot:arsdk:3.13.1' (or implementation 'com.parrot:arsdk:3.13.1' for newer versions of the gradle plugin).
  • Before calling any methods from the SDK, be sure to call ARSDK.loadSDKLibs();


I appreciate the reply but, just to be clear I was specifically asking about using the .so files and you gave me an answer telling me how to use the pre compiled libs… I’ve read through the docs many times but, there are no real instructions for setting the project up with your own custom built SDK. For example you guys give an example gradle file including all the projects but you had no instructions on how to get the aar files to actually include those modules in Android Studio. I had to pull apart the source to find out that you have to use the buildSample to get an aar for each sub project that I can add as dependencies to my project. As far as I found the docs had 0 mention of this. After actually building and generating the .so files the docs just leave you on your own with 0 instruction on getting those .so files working inside of your own project



We do provide a way to build the samples with a locally build SDK. The inclusion of the generated .so files into an AAR (the arsdk.aar file) is done in the ARSDK build.gradle, at lines 20-23. Gradle will embed into the library any .so found into the jniLibs.srcdirs property of the project.



Thanks for the reply and sorry for the confusion. I was looking for instructions on adding the SO files into my own app not into the sample app. I have figured everything out now and have my environment up and running with my build of the sdk. Sorry for not being more clear that I was trying to use them in a project other than the sample project. Thank you guys for the replies either way though!

For whats its worth I do think it would be cool(and maybe I could even pitch in and write this for you guys) to have instructions on building everything from source and then including all the dependencies and getting everything setup in an app that is started from scratch(not the sample app). I’m sure I’m not the only person out there who had an app that was previously using the pre built sdk and want to switch it over to there own build. Let me know if this is something the two of you think you be a good idea and I would be happy to write something up and send it over for final edits!