Click here to Skip to main content
15,885,278 members
Articles / Mobile Apps / Android
Article

SQLCipher: Compilation for Intel® x86 for the Android Platform

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
1 Mar 2016CPOL3 min read 7.4K  
This document provides step-by-step instructions on how to build SQLCipher for Android on a Linux host, with architecture settings to an Intel® x86 target.

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Intel® Developer Zone offers tools and how-to information for cross-platform app development, platform and technology information, code samples, and peer expertise to help developers innovate and succeed. Join our communities for Android, Internet of Things, Intel® RealSense™ Technology, and Windows to download tools, access dev kits, share ideas with like-minded developers, and participate in hackathon’s, contests, roadshows, and local events.

This document provides step-by-step instructions on how to build SQLCipher for Android on a Linux* host, with architecture settings to an Intel® x86 target.

SQLCipher is an open source extension to SQLite* that provides transparent 256-bit AES encryption of database files. SQLCipher has been adopted as a secure database solution by many commercial and open source products, making it one of the most popular encrypted database platforms for Mobile, Embedded, and Desktop applications.

SQLCipher was developed by Zetetic LLC and initially released in November 2008. At first, SQLCipher was solely used as the security backend for our password manager and data vault, Strip. However, because of its low overhead and compact size, it quickly became popular and is now one of the most heavily used secure database solutions for the platform. In 2011, amid increasing calls for Android support, the Guardian Project and Zetetic jointly released SQLCipher for Android. Along the way, SQLCipher has also been used successfully on other platforms as well, including Windows* C/C++, .NET, Ruby*, Java*, PHP*, Python*, QT*, Mac OS X*, and Linux.

Setting Up in a Linux Environment

Below is the recommended procedure for setting up in a Linux Environment.

Setup and Prerequisites

Before starting, you’ll need to download and install the following:

  1. Download the Android SDK
  2. Download the Android NDK
  3. Download the Java Development Kit (JDK)

The open source SQLCipher for Android can be downloaded from https://www.zetetic.net/sqlcipher/open-source/ URL using the following command:

git clone <a href="https://github.com/sqlcipher/android-database-sqlcipher.git" rel="nofollow">https://github.com/sqlcipher/android-database-sqlcipher.git</a>

After you get the repository cloned to the local file system, you can move on to the Build Procedure in a Linux Environment section.

The Build Procedure in a Linux Environment

Once you extract the contents to a local directory, say

/home/test/android-database-cipher/

Perform the following steps:

  • Cd /home/test/android-database-cipher/
  • ~/android-database-cipher> make init

Note: This will take quite a bit of time to clone the required libraries for Android sqlcipher.

The following libraries will be cloned and downloaded as part of sqlcipher external libraries:

  • external/sqlcipher
  • external/android-sqlite
  • external/dalvik
  • external/icu4c
  • external/openssl
  • external/platform-frameworks-base

Perform the following step:

~/android-database-cipher> make

Note: This builds all the libraries for the target architectures mentioned in the Application.mk file. If the make fails, please refer to the Troubleshooting and Known Issues section at the end of the document.

Intel x86 Android Configuration setting

The architecture configuration can be made similar to that of an Android Project. Make sure you have the following configuration for Intel x86:

Open <project-folder>/jni/Application.mk

Make sure you have the following setting:

APP_ABI := x86

Output Section

Once the build completes successfully, the binaries gets generated in to the following path:

<project-dir>/libs/x86/libdatabase_sqlcipher.so

<project-dir>/libs/x86/libsqlcipher_android.so

<project-dir>/libs/x86/libstlport_shared.so

Troubleshooting and Known Issues

  • Issue: Make Failure saying “android update project” fails.
    • Resolution: Make sure you have appended the Android tools path to the PATH environment.
    • Example: export PATH=$PATH:~/Android/adtbundle/sdk/tools
      • export PATH=$PATH:~/Android/adtbundle/sdk/build-tools/android-4.4
  • Issue: Make command fails, saying “ndk-build : command not found”
    • Resolution: Make sure you have appended the ndk-build path to the PATH environment.
    • Example: export PATH=$PATH:~/Android/android-ndk-r9b
  • Issue: If you get an error saying “build.xml not found.”
    • Resolution: Make sure you have generated the build.xml automatically by issuing the following commands:
      • ~/sqlcipher/android-database-sqlcipher> cd ..
      • ~/sqlcipher> android update project --target 1 --path ./ --subprojects

      Note: To obtain the target id, issue the command android list targets

      • ~/sqlcipher> cd android-database-sqlcipher
      • ~/sqlcipher/android-database-sqlcipher> make

References

SQLCipher Community Edition:https://www.zetetic.net/sqlcipher/open-source/

Compile SQLite with SQLCipher on Windows: http://stackoverflow.com/questions/4353037/compile-sqlite-with-sqlcipher-on-windows/4399633#4399633

SQLCipher for Android Application Integration: https://www.zetetic.net/sqlcipher/sqlcipher-for-android/

About the Author

Praveen Kundurthy works in the Intel® Software and Services Group. He has a master’s degree in Computer Engineering. His main interests are mobile technologies, Microsoft Windows*, and game development.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
Intel is inside more and more Android devices, and we have tools and resources to make your app development faster and easier.


Comments and Discussions

 
-- There are no messages in this forum --