I have downloaded the SQLite Android Bindings source code from sqlite.org, and I’m trying to compile them for use in Unity. I have precompiled .so files (armeabi-v7a & x86) I found online that currently work in my project, so theoretically I should be able to build the newest version of SQLite and drop them in my project, and they should work. But when I do that, I’m getting the following errors:
E/SQLiteConnection: Unable to find class org/sqlite/database/sqlite/SQLiteCustomFunction
A/art: art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception 'java.lang.ClassNotFoundException' thrown in unknown throw location
A/art: art/runtime/check_jni.cc:65] in call to GetFieldID
A/art: art/runtime/check_jni.cc:65] from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String)
A/art: art/runtime/check_jni.cc:65] "UnityMain" prio=5 tid=11 Runnable
A/art: art/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x12c28b30 self=0xb4f07c00
A/art: art/runtime/check_jni.cc:65] | sysTid=30831 nice=-11 cgrp=apps sched=0/0 handle=0xafb39800
A/art: art/runtime/check_jni.cc:65] | state=R schedstat=( 3334842404 353100347 7206 ) utm=293 stm=40 core=2 HZ=100
A/art: art/runtime/check_jni.cc:65] | stack=0xb3aaa000-0xb3aac000 stackSize=1036KB
A/art: art/runtime/check_jni.cc:65] | held mutexes= "mutator lock"(shared held)
A/art: art/runtime/check_jni.cc:65] native: #00 pc 00004640 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
A/art: art/runtime/check_jni.cc:65] native: #01 pc 00002e8d /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
A/art: art/runtime/check_jni.cc:65] native: #02 pc 00248469 /system/lib/libart.so (art::smile:umpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
A/art: art/runtime/check_jni.cc:65] native: #03 pc 0022cdf3 /system/lib/libart.so (art::Thread::smile:ump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146)
A/art: art/runtime/check_jni.cc:65] native: #04 pc 000b189b /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
A/art: art/runtime/check_jni.cc:65] native: #05 pc 000b1fd5 /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
A/art: art/runtime/check_jni.cc:65] native: #06 pc 000b50e5 /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1284)
A/art: art/runtime/check_jni.cc:65] native: #07 pc 000b7353 /system/lib/libart.so (art::CheckJNI::GetFieldID(_JNIEnv*, _jclass*, char const*, char const*)+26)
A/art: art/runtime/check_jni.cc:65] native: #08 pc 0000d07f /data/app/com.statusnotquo.layer-1/lib/arm/libsqlite3.so (android::register_android_database_SQLiteConnection(_JNIEnv*)+50)
A/art: art/runtime/check_jni.cc:65] native: #09 pc 0000d1af /data/app/com.statusnotquo.layer-1/lib/arm/libsqlite3.so (JNI_OnLoad+34)
A/art: art/runtime/check_jni.cc:65] native: #10 pc 001d4c37 /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, art::Handle<art::mirror::ClassLoader>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1478)
A/art: art/runtime/check_jni.cc:65] native: #11 pc 001fc9c1 /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+548)
A/art: art/runtime/check_jni.cc:65] native: #12 pc 000197f9 /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+152)
A/art: art/runtime/check_jni.cc:65] at java.lang.Runtime.nativeLoad(Native method)
A/art: art/runtime/check_jni.cc:65] at java.lang.Runtime.doLoad(Runtime.java:428)
A/art: art/runtime/check_jni.cc:65] - locked <0x3ebd3456> (a java.lang.Runtime)
A/art: art/runtime/check_jni.cc:65] at java.lang.Runtime.load(Runtime.java:329)
A/art: art/runtime/check_jni.cc:65] at java.lang.System.load(System.java:982)
A/art: art/runtime/check_jni.cc:65] at com.unity3d.player.UnityPlayer.nativeRender(Native method)
A/art: art/runtime/check_jni.cc:65] at com.unity3d.player.UnityPlayer.a(unavailable:-1)
A/art: art/runtime/check_jni.cc:65] at com.unity3d.player.UnityPlayer$b.run(unavailable:-1)
A/art: art/runtime/runtime.cc:286] Pending exception java.lang.ClassNotFoundException thrown by 'unknown throw location'
A/art: art/runtime/runtime.cc:286] java.lang.ClassNotFoundException: Didn't find class "org.sqlite.database.sqlite.SQLiteCustomFunction" on path: DexPathList[[zip file "/data/app/com.statusnotquo.layer-1/base.apk"],nativeLibraryDirectories=[/data/app/com.statusnotquo.layer-1/lib/arm, /vendor/lib, /system/lib]]
A/art: art/runtime/runtime.cc:286] at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
A/art: art/runtime/runtime.cc:286] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
A/art: art/runtime/runtime.cc:286] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
A/art: art/runtime/runtime.cc:286] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
A/art: art/runtime/runtime.cc:286] at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:428)
A/art: art/runtime/runtime.cc:286] at void java.lang.Runtime.load(java.lang.String, java.lang.ClassLoader) (Runtime.java:329)
A/art: art/runtime/runtime.cc:286] at void java.lang.System.load(java.lang.String) (System.java:982)
A/art: art/runtime/runtime.cc:286] at boolean com.unity3d.player.UnityPlayer.nativeRender() ((null):-2)
A/art: art/runtime/runtime.cc:286] at boolean com.unity3d.player.UnityPlayer.a(com.unity3d.player.UnityPlayer) ((null):-1)
A/art: art/runtime/runtime.cc:286] at void com.unity3d.player.UnityPlayer$b.run() ((null):-1)
When I unzip the apk, I can see that both the armeabi-v7a and x86 versions of libsqlite3.so are in the project.
I’ve checked sqlite.org’s binding download, and it does contain the org.sqlite.database.sqlite.SQLiteCustomFunction class.
For reference, here is the version information:
SQLITE_VERSION “3.8.7”
SQLITE_VERSION_NUMBER 3008007
SQLITE_SOURCE_ID “2014-10-16 18:34:50 1418c006e377d7915a50577d4ccb21125b750bae”
Unity Version 5.3.4f1
Has anyone run into this before? Are there any custom commands that needs to be added to the Android.mk file in order to build SQLite in Unity?
Any help would be much appreciated!