Unlike liblog. So, Android does not directly open libsqlite. So for external use.
Although Android provides a Java interface for accessing SQLite, you need to access SQLite using C language in ndk.
There are two methods:
First, use the source code sqlite3.h and sqlite3.c.
Download the SQLite. Git library from the android source code website, find the two files, and put them in the project source code for ndk compilation.
Advantage: simple and easy to think
Disadvantage: The/system/lib/libsqlite. So file cannot be effectively used, resulting in a large library file.
Method 2:
This method is obtained based on the liblog. So method.
1. First ADB pull/system/lib/libsqlite. So to get the libsqlite. So file
2. Place the libsqlite. So file in the $ ndk/platforms/Android-3/arch-arm/usr/lib directory.
3. Place sqlite3.h in the $ ndk/platforms/Android-3/arch-arm/usr/include/Android directory.
4. Add the statement local_ldlibs: =-lsqlite to the Android. mk file.
5. Perform ndk Compilation
The $ ndk/platform/directory may contain multiple subdirectories, which can be placed in the corresponding directory as needed. If not, add the sqlite3.h libsqlite. So file to each subdirectory.