Android build faile

I build the source
execute “make init”
and the log:
rc5test.c => dummytest.c
jpaketest.c => dummytest.c

Configured for dist.

The library could not be configured for supporting multi-threaded
applications as the compiler options required on this system are not known.
See file INSTALL for details if you need multi-threading.

*** Because of configuration changes, you MUST do the following before
*** building:

make depend

IIgnore it, I execute "make"
then log:
[x86] Install : libdatabase_sqlcipher.so => jni/libs/x86/libdatabase_sqlcipher.so
[x86] Install : libstlport_shared.so => jni/libs/x86/libstlport_shared.so
ant release
Buildfile: build.xml does not exist!
Build failed
make: *** [build-java] Error 1

Why???

Please help me to sovle this problem!!! Thinks very much!

Hi @YuriZheng

Try running make init again and reach through the output. It is likely that this line failed on your machine.

The command had be executed for several times, then log:
clienthellotest.c => …/test/clienthellotest.c
sslv2conftest.c => …/test/sslv2conftest.c
making links in engines…
making links in engines/ccgost…
make[3]: Nothing to be done for links'. making links in apps... make[2]: Nothing to be done forlinks’.
making links in test…
make[2]: Nothing to be done for links'. making links in tools... make[2]: Nothing to be done forlinks’.
generating dummy tests (if needed)…
md2test.c => dummytest.c
rc5test.c => dummytest.c
jpaketest.c => dummytest.c

Configured for dist.

The library could not be configured for supporting multi-threaded
applications as the compiler options required on this system are not known.
See file INSTALL for details if you need multi-threading.

*** Because of configuration changes, you MUST do the following before
*** building:

make depend

I check the Makefile. As same as this . I do not know how to do it

Execute “make”, log:
/Users/ZYJ/Documents/GitHub/android-database-sqlcipher/jni/net_sqlcipher_CursorWindow.cpp: In function ‘jboolean sqlcipher::isFloat_native(JNIEnv*, jobject, jint, jint)’:
/Users/ZYJ/Documents/GitHub/android-database-sqlcipher/jni/net_sqlcipher_CursorWindow.cpp:300:16: warning: converting to non-pointer type ‘jboolean {aka unsigned char}’ from NULL [-Wconversion-null]
return NULL;
^
[x86] Compile++ : database_sqlcipher <= CursorWindow.cpp
[x86] SharedLibrary : libdatabase_sqlcipher.so
[x86] Install : libdatabase_sqlcipher.so => jni/libs/x86/libdatabase_sqlcipher.so
[x86] Install : libstlport_shared.so => jni/libs/x86/libstlport_shared.so
ant release
Buildfile: build.xml does not exist!
Build failed
make: *** [build-java] Error 1

libs/arameabi
libs/arameabi-v7a
libs/x86
has already generated, but no sqlcipher.jar. Why?

That means either you did not do make init on a clean project or Makefile line 36 android update project -p . failed. Note that project.properties assumes that the android-19 target is available on your system.

If you take a careful look at the Makefile you will see that the build runs in 3 major stages:

  • build JNI libraries (some in the external subdirectory and some in the jni subdirectory)
  • build Java using ant
  • copy the native libraries to libs

The JNI build does not seem to about the installed Android SDK version. But when you build the Java code it will look for the SDK version as specified in project.properties.

P.S. You may want to try the new android-n-preview branch, which would be a quicker build since they removed the ICU dependency.

A little dizzy!

You mean that my build-tool version is wrong?

I modify project.properties:
target=android-23

Then:
-check-env:
[checkenv] Android SDK Tools Revision 25.1.3
[checkenv] Installed at /Users/ZYJ/Library/Android/sdk

-build-setup:
[getbuildtools] Using latest Build Tools: 23.0.2
[echo] Resolving Build Target for android-database-sqlcipher…
[gettarget] Project Target: Android 6.0
[gettarget] API level: 23

-pre-compile:

-compile:
[javac] Compiling 36 source files to /Users/ZYJ/Documents/GitHub/android-database-sqlcipher/bin/classes
[javac] /Users/ZYJ/Documents/GitHub/android-database-sqlcipher/src/net/sqlcipher/BulkCursorToCursorAdaptor.java:35: error: BulkCursorToCursorAdaptor is not abstract and does not override abstract method setExtras(Bundle) in Cursor
[javac] public final class BulkCursorToCursorAdaptor extends AbstractWindowedCursor {
[javac] ^
[javac] /Users/ZYJ/Documents/GitHub/android-database-sqlcipher/src/net/sqlcipher/MatrixCursor.java:29: error: MatrixCursor is not abstract and does not override abstract method setExtras(Bundle) in Cursor
[javac] public class MatrixCursor extends AbstractCursor {
[javac] ^
[javac] /Users/ZYJ/Documents/GitHub/android-database-sqlcipher/src/net/sqlcipher/database/SQLiteCursor.java:44: error: SQLiteCursor is not abstract and does not override abstract method setExtras(Bundle) in Cursor
[javac] public class SQLiteCursor extends AbstractWindowedCursor {
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: /Users/ZYJ/Documents/GitHub/android-database-sqlcipher/src/net/sqlcipher/database/SQLiteContentHelper.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 3 errors

The libs has nothing.

I’m sorry to understand you,Could you explan them about more detail. Ths!

Yes. For some reason the newer Android SDK added some more abstract methods. I would also like to see SQLCipher for Android override these additional methods, perhaps to simply throw a runtime exception with a message that they are not implemented.

The method setExtras(Bundle) must overrided above 23, and then i modify the target=android-21.
Build success!!!

tree libs
libs
├── armeabi
│ ├── libdatabase_sqlcipher.so
│ ├── libsqlcipher_android.so
│ └── libstlport_shared.so
└── sqlcipher.jar
└── sqlcipher-javadoc.jar

Thanks very much!

But i think that if i run the application on android-23, would it throw a runtime exception?

I think this would only happen if something tries to call the setExtras method on the Cursor subclasses.

The only fix you should need to build on android-23 is to implement a bogus AbstractCursor.setExtras method like:

public void setExtras(Bundle ignored) {
    throw new RuntimeException("void setExtras(Bundle) not implemented");
}

I raised https://github.com/sqlcipher/android-database-sqlcipher/pull/230 to fix this in the Android N preview branch.