简体   繁体   中英

Unable to load native library when running titanium android app

I'm building an Android app using Titanium. My Android module com.tgl.androidmodule includes a native lib called libAlibrary-jni.so .

In my .apk, the native libs are present in their correct folders (lib/armeabi, lib/armeabi-v7a, lib/x86) but I still get an error when trying to load the library dynamically : System.loadLibrary("Alibrary-jni");

Here is the full stacktrace of the error:

11-12 08:46:00.654: D/dalvikvm(381): Trying to load lib /data/data/com.fw.test/lib/libstlport_shared.so 0x41e407e8
11-12 08:46:00.669: D/AndroidmoduleModule(381): (main) [18,433] inside onAppCreate
11-12 08:46:00.669: D/dalvikvm(381): Trying to load lib /data/data/com.fw.test/lib/libAlibrary-jni.so 0x41e407e8
11-12 08:46:00.719: D/dalvikvm(381): Added shared lib /data/data/com.fw.test/lib/libstlport_shared.so 0x41e407e8
11-12 08:46:00.719: D/dalvikvm(381): No JNI_OnLoad found in /data/data/com.fw.test/lib/libstlport_shared.so 0x41e407e8, skipping init
11-12 08:46:00.719: D/dalvikvm(381): Trying to load lib /data/data/com.fw.test/lib/libkroll-v8.so 0x41e407e8
11-12 08:46:00.879: D/dalvikvm(381): Added shared lib /data/data/com.fw.test/lib/libkroll-v8.so 0x41e407e8
11-12 08:46:01.039: D/dalvikvm(381): Added shared lib /data/data/com.fw.test/lib/libAlibrary-jni.so 0x41e407e8
11-12 08:46:01.054: D/dalvikvm(381): No JNI_OnLoad found in /data/data/com.fw.test/lib/libgeniusscanlibrary-jni.so 0x41e407e8, skipping init
11-12 08:46:01.959: E/TiApplication(381): (KrollRuntimeThread) [345,345] Sending event: exception on thread: KrollRuntimeThread msg:java.lang.UnsatisfiedLinkError: Couldn't load com.tgl.androidmodule: findLibrary returned null; Titanium 3.1.3,2013/09/18 12:01,222f4d1
11-12 08:46:01.959: E/TiApplication(381): java.lang.UnsatisfiedLinkError: Couldn't load com.tgl.androidmodule: findLibrary returned null
11-12 08:46:01.959: E/TiApplication(381):     at java.lang.Runtime.loadLibrary(Runtime.java:365)
11-12 08:46:01.959: E/TiApplication(381):     at java.lang.System.loadLibrary(System.java:535)
11-12 08:46:01.959: E/TiApplication(381):     at org.appcelerator.kroll.runtime.v8.V8Runtime.loadExternalModules(V8Runtime.java:114)
11-12 08:46:01.959: E/TiApplication(381):     at org.appcelerator.kroll.runtime.v8.V8Runtime.initRuntime(V8Runtime.java:81)
11-12 08:46:01.959: E/TiApplication(381):     at org.appcelerator.kroll.KrollRuntime.doInit(KrollRuntime.java:175)
11-12 08:46:01.959: E/TiApplication(381):     at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:109) 

Any suggestion?

Actually, this issue had nothing to do with my C++ lib, it was a pure Titanium problem. I understood thanks to this Jira issue that I only needed to install gperf to solve this issue. No need to say the error message was misleading. Thanks to Chris Stratton for his help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM