Using the. So library file (for example, libsqlite. So) in the Android system for ndk Development)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.