Reputation: 452
I want to add native code specific to a device to my native android libs.
So, in other words, I have a folder full of *.so
files:
I then have a seperate CN1Lib app with native code contianing several libs. The example app showes this folder being added alongside normal .jar libs, so I did the same with codenameone:
The soFolder
containing all the so
files (named correctly as per example android app).
I then build this CN1Lib, and add it to the main project under the lib folder, which works.
However, when I inspect the codenameone APK and compare it to the example android app, the .so files sit in different locations. The example app has it under a lib
folder in its root, and the codenameone app has it under the assets
folder. This causes the device that requires these files to not be able to find them.
The example app being on the left, and the codenameone app being on the right.
Is there any way to get the so
folder under a lib
folder in the apk file using codenameone?
Assistance is appreciated.
Upvotes: 2
Views: 118
Reputation: 46
If you don't want to go through the trouble of creating an AAR there is a semi-solution.
You could create a normal android library project, and after building it, manually open the archive and just drop the lib folder in there. You then add this jar file as a native android dependency.
When the build returns from codenameone, the folder should be sitting in the apk file :)
The correct way is most likely the AAR approach, but its not as straight-forward to do for a once-off solution.
Upvotes: 2
Reputation: 52760
I haven't worked on this much so I'm not a big expert here but as far as I understand you need to create an AAR file in Android Studio and use that. Based on the developer guide section here.
Upvotes: 1