I created Spatialite-Database-Driver to enable the usage of spatialite android in Android applications in more recent Android Studio (v1.3) build environments.
See HelloToSpatialite for an example of using this module in a simple spatialite application.
The shared objects and source files in this repository are not mine. They were copied from other sources as explained next. My contribution here is figuring out how to package this library up in the relatively new Android Studio environment and how to use it in a separate application.
I copied the shared objects from geopaparazzispatialitelibrary/libs
and the java jsqlite code from geopaparazzispatialitelibrary/src/jsqlite
Many Android apps today use libraries and lots of the time libraries are embedded in those apps instead of being separate components.
I wanted to make this library a separate component to make it easier for everyone to download it and use it in their own apps.
I followed these two posts to create that standalone module since it is not something Android Studio does for you automatically:
- http://stackoverflow.com/questions/22243269/how-to-share-a-single-library-source-across-multiple-projects
- https://gist.github.com/daniellevass/2c46cf33e3814e685b47
I followed the steps in the first link except for step 2 where I had to refer to the second post to know to rename the folder at the terminal and drag the build.gradle.
In this repository, Credits.java shows a vanilla example of java that you might see in a module.
There is a lot you can do in a module, of course, beyond this.
I copied the contents (shared objects in their architecture specific folders) from:
to
I copied the jsqlite java from:
to:
Important! I had to remove the 'mycompany' scoping from the AndroidManifest to enable projects using this module to invoke 'import jsqlite;'.
Now the library is ready to use!
Any project wishing to use this module will need to take some steps as shown in HelloToSpatialite.
-
I used this application as an example to help me set things up and as a source for java and shared objects:
-
Thanks to @mj10777 for helping me out in this thread:
Some articles I found useful during this work as they explained some concept I needed to understand:
- NDK with Android Studio
- Java Programming Tutorial: Java Native Interface (JNI)
- These two sources helped me get started with creating a standalone library module in Android Studio