Build android-database-sqlcipher from source on windows

Hello,
I’m new with android-database-sqlcipher, and I succefully implement android sqlcipher to my app by adding “implementation ‘net.zetetic:android-database-sqlcipher:4.2.0’” to my module’s “build.gradle” “dependencies”.

Now I want to make a very small change to the source code and build “android-database-sqlcipher” from the source. I had downloaded the source from GitHub - sqlcipher/android-database-sqlcipher: Android SQLite API based on SQLCipher and without making any changes, I add android-database-sqlcipher to my app using “Import module in android studio”. I got the following ERROR: Plugin with id ‘org.ec4j.editorconfig’ not found.

Can I make changes to the source code and add the result to my app? if the answer is yes. How can I do it on windows with android studio 3.4.

Thanks in advance.

Hi @Youcef_Maouche

While I’m sure you could build SQLCipher for Android on Windows, the build system is not currently setup to do so. Your best bet would be to follow the build instructions on a Linux or macOS host. This can be done with a virtual machine if you don’t have that available.

Hi @developernotes

Thanks for your reply, I will give this try.

@developernotes I’m sorry to get back to you again. I am trying building the library, using the instructions, on linux. I installed the ndk r15c, exported ANDROID_NDK_ROOT, and run make init and I get the following

git submodule update --init
make: git: Command not found
make: *** [Makefile:7: init] Error 127

I tried also build-release but after sometime I get the following error

Task :android-database-sqlcipher:buildAmalgamation FAILED
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:android-database-sqlcipher:buildAmalgamation’.

A problem occurred starting process 'command ‘./configure’

am I doing something wrong?

Hi @Youcef_Maouche

Make sure you have the git toolset installed and available on your PATH environment variable.

Hi @developernotes, thanks for your reply

I install git toolset make init command give me this now

git submodule update --init

Unfortunately, make build-release command give the same error

Task :android-database-sqlcipher:buildAmalgamation FAILED
FAILURE: Build failed with an exception.What went wrong:

Execution failed for task ‘:android-database-sqlcipher:buildAmalgamation’.

A problem occurred starting process 'command ‘./configure’

@Youcef_Maouche you will need to debug you local environment. When you receive errors for tasks run within gradle, it prompts you to gather more information with either the --info, or --debug flags. Try running the specific task again to see what information is reported:

./gradlew android-database-sqlcipher:buildAmalgamation --info

@developernotes
runinig

give

Initialized native services in: /home/youcef/.gradle/native
Found daemon DaemonInfo{pid=13325, address=[df7b3bd5-eb6e-4646-8bbd-7bd0fac76a98 port:43089, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1571683752651, context=DefaultDaemonContext[uid=c3c9008e-8b11-4c7b-a356-069997f3dcc2,javaHome=/usr/lib/jvm/java-11-openjdk-amd64,daemonRegistryDir=/home/youcef/.gradle/daemon,pid=13325,idleTimeout=10800000,priority=NORMAL,daemonOpts=–add-opens,java.base/java.util=ALL-UNNAMED,–add-opens,java.base/java.lang=ALL-UNNAMED,–add-opens,java.base/java.lang.invoke=ALL-UNNAMED,–add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/home/youcef/Desktop/android-studio/jre,daemonRegistryDir=/home/youcef/.gradle/daemon,pid=20243,idleTimeout=null,priority=NORMAL,daemonOpts=-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=c3c9008e-8b11-4c7b-a356-069997f3dcc2,javaHome=/usr/lib/jvm/java-11-openjdk-amd64,daemonRegistryDir=/home/youcef/.gradle/daemon,pid=13325,idleTimeout=10800000,priority=NORMAL,daemonOpts=–add-opens,java.base/java.util=ALL-UNNAMED,–add-opens,java.base/java.lang=ALL-UNNAMED,–add-opens,java.base/java.lang.invoke=ALL-UNNAMED,–add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]

Looking for a different daemon…
The client will now receive all logging from the daemon (pid: 6930). The daemon log file: /home/youcef/.gradle/daemon/5.4.1/daemon-6930.out.log
Starting 24th build in daemon [uptime: 1 hrs 35 mins 36.519 secs, performance: 96%, non-heap usage: 34% of 268.4 MB]
Using 12 worker leases.
Starting Build
Settings evaluated using settings file ‘/home/youcef/Desktop/yes/android-database-sqlcipher-master/settings.gradle’.
Projects loaded. Root project using build file ‘/home/youcef/Desktop/yes/android-database-sqlcipher-master/build.gradle’.
Included projects: [root project ‘android-database-sqlcipher-master’, project ‘:android-database-sqlcipher’]

Configure project :
Evaluating root project ‘android-database-sqlcipher-master’ using build file ‘/home/youcef/Desktop/yes/android-database-sqlcipher-master/build.gradle’.

Configure project :android-database-sqlcipher
Evaluating project ‘:android-database-sqlcipher’ using build file ‘/home/youcef/Desktop/yes/android-database-sqlcipher-master/android-database-sqlcipher/build.gradle’.
Creating configuration androidTestUtil
Creating configuration compile
Creating configuration publish
Creating configuration provided
Creating configuration api
Creating configuration implementation
Creating configuration runtimeOnly
Creating configuration compileOnly
Creating configuration wearApp
Creating configuration annotationProcessor
Creating configuration androidTestCompile
Creating configuration androidTestPublish
Creating configuration androidTestProvided
Creating configuration androidTestApi
Creating configuration androidTestImplementation
Creating configuration androidTestRuntimeOnly
Creating configuration androidTestCompileOnly
Creating configuration androidTestWearApp
Creating configuration androidTestAnnotationProcessor
Creating configuration testCompile
Creating configuration testPublish
Creating configuration testProvided
Creating configuration testApi
Creating configuration testImplementation
Creating configuration testRuntimeOnly
Creating configuration testCompileOnly
Creating configuration testWearApp
Creating configuration testAnnotationProcessor
Creating configuration debugCompile
Creating configuration debugPublish
Creating configuration debugProvided
Creating configuration debugApi
Creating configuration debugImplementation
Creating configuration debugRuntimeOnly
Creating configuration debugCompileOnly
Creating configuration debugWearApp
Creating configuration debugAnnotationProcessor
Creating configuration androidTestDebugCompile
Creating configuration androidTestDebugPublish
Creating configuration androidTestDebugProvided
Creating configuration androidTestDebugApi
Creating configuration androidTestDebugImplementation
Creating configuration androidTestDebugRuntimeOnly
Creating configuration androidTestDebugCompileOnly
Creating configuration androidTestDebugWearApp
Creating configuration androidTestDebugAnnotationProcessor
Creating configuration testDebugCompile
Creating configuration testDebugPublish
Creating configuration testDebugProvided
Creating configuration testDebugApi
Creating configuration testDebugImplementation
Creating configuration testDebugRuntimeOnly
Creating configuration testDebugCompileOnly
Creating configuration testDebugWearApp
Creating configuration testDebugAnnotationProcessor
Creating configuration releaseCompile
Creating configuration releasePublish
Creating configuration releaseProvided
Creating configuration releaseApi
Creating configuration releaseImplementation
Creating configuration releaseRuntimeOnly
Creating configuration releaseCompileOnly
Creating configuration releaseWearApp
Creating configuration releaseAnnotationProcessor
Creating configuration testReleaseCompile
Creating configuration testReleasePublish
Creating configuration testReleaseProvided
Creating configuration testReleaseApi
Creating configuration testReleaseImplementation
Creating configuration testReleaseRuntimeOnly
Creating configuration testReleaseCompileOnly
Creating configuration testReleaseWearApp
Creating configuration testReleaseAnnotationProcessor
Parsing the SDK, no caching allowed
SDK initialized in 7 ms
All projects evaluated.
Analytics other plugin to proto: Unknown plugin type org.ec4j.gradle.EditorconfigGradlePlugin expected enum ORG_EC4J_GRADLE_EDITORCONFIGGRADLEPLUGIN
Selected primary task ‘android-database-sqlcipher:buildAmalgamation’ from project :android-database-sqlcipher
Tasks to be executed: [task ‘:android-database-sqlcipher:buildAmalgamation’]
:android-database-sqlcipher:buildAmalgamation (Thread[Execution worker for ‘:’,5,main]) started.

Task :android-database-sqlcipher:buildAmalgamation FAILED
Caching disabled for task ‘:android-database-sqlcipher:buildAmalgamation’ because:
Build cache is disabled
Task ‘:android-database-sqlcipher:buildAmalgamation’ is not up-to-date because:
Task has not declared any outputs despite executing actions.
Starting process ‘command ‘./configure’’. Working directory: /home/youcef/Desktop/yes/android-database-sqlcipher-master/android-database-sqlcipher/src/main/external/sqlcipher Command: ./configure --enable-tempstore=yes --with-crypto-lib=none
:android-database-sqlcipher:buildAmalgamation (Thread[Execution worker for ‘:’,5,main]) completed. Took 0.005 secs.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:android-database-sqlcipher:buildAmalgamation’.

A problem occurred starting process ‘command ‘./configure’’

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s
1 actionable task: 1 executed

@Youcef_Maouche try running make distclean, then run make build-debug again.

@developernotes the same error appeared again

Task :android-database-sqlcipher:buildOpenSSL SKIPPED
/home/youcef/Desktop/yes/android-database-sqlcipher-master/android-database-sqlcipher/src/main/external/android-libs/armeabi/libcrypto.a exists SKIPPED

Task :android-database-sqlcipher:buildAmalgamation FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:android-database-sqlcipher:buildAmalgamation’.

A problem occurred starting process ‘command ‘./configure’’

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 0s
2 actionable tasks: 2 executed
make: *** [Makefile:19: check] Error

make `distclean showed

Task :android-database-sqlcipher:cleanSQLCipher FAILED
fatal: You are on a branch yet to be born

FAILURE: Build failed with an exception.

  • Where:
    Script ‘/home/youcef/Desktop/yes/android-database-sqlcipher-master/android-database-sqlcipher/native.gradle’ line: 116

  • What went wrong:
    Execution failed for task ‘:android-database-sqlcipher:cleanSQLCipher’.

Process ‘command ‘git’’ finished with non-zero exit value 128

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

You need to continue debugging the local environment. You might try buildAmalgamation again with the --debug flag set to see if you can learn more about the issue you are experiencing.

@developernotes thaaaaanks

@Youcef_Maouche were you able to resolve your local build issue?

@developernotes unfortunately not yet.