根据我的Application.mk
,我正在编译armeabi-v7a和armeabi版本的C ++共享库。我如何知道在运行时加载哪个版本?是否有类似的Java代码设置,或者是一个格式错误的问题?
答案 0 :(得分:3)
如果您想在本机代码中了解它,请尝试在hello-jni ndk示例中进行操作android-ndk\samples\hello-jni\jni\hello-jni.c
#if defined(__arm__)
#if defined(__ARM_ARCH_7A__)
#if defined(__ARM_NEON__)
#if defined(__ARM_PCS_VFP)
#define ABI "armeabi-v7a/NEON (hard-float)"
#else
#define ABI "armeabi-v7a/NEON"
#endif
#else
#if defined(__ARM_PCS_VFP)
#define ABI "armeabi-v7a (hard-float)"
#else
#define ABI "armeabi-v7a"
#endif
#endif
#else
#define ABI "armeabi"
#endif
#elif defined(__i386__)
#define ABI "x86"
#elif defined(__x86_64__)
#define ABI "x86_64"
#elif defined(__mips64) /* mips64el-* toolchain defines __mips__ too */
#define ABI "mips64"
#elif defined(__mips__)
#define ABI "mips"
#elif defined(__aarch64__)
#define ABI "arm64-v8a"
#else
#define ABI "unknown"
#endif
return (*env)->NewStringUTF(env, "Hello from JNI ! Compiled with ABI " ABI ".");
答案 1 :(得分:0)
使用android framework api检查您的处理器架构。根据那个特别的.so loaded。