问题
I've made a jni library that dynamically loads plugins using dlopen, plugin library files have a different naming e.g. zzz_abc.so
.
eclipse and ant are correctly bundling these files in the apk, but the android packagemanager only unpacks files named libxxx.so
, other filename patterns are ignored, perhaps in debug, gdbserver is added and unpacked on my 4.1 phone (but not on 4.4 genymotion emulator).
There is something "magic" to control this behavior?
回答1:
I've verified and unfortunately the native library installer only copies filenames like libxxx.so
and gdbserver
, if someone is interested the code is in frameworks/base/core/jni/com_android_internal_content_NativeLibraryHelper.cpp.
回答2:
Android Package Manager copies libraries according to device processor architecture (armv7a, armv6, x86, mips). So if you use x86 based emulator, you need to provide x86 build of your library.
来源:https://stackoverflow.com/questions/23568461/android-package-manager-only-unpacks-libxxx-so-named-libraries