We have encountered many mistakes in the development of Android JNI, especially for those students who have just started to learn about the development of the JNI , which summarizes the mistakes we often encounter. These errors are often encountered by you.
Error 1:java.lang.unsatisfiedlinkerror:native method not found: local methods not found
1. Local function name is incorrectly written
2. Forgot to load the. so file without calling System.loadlibrary
error 2:findlibrary returned null
1, System.loadlibrary ("Libhello"); Dynamic link library name is wrong when loading dynamic link library
2. Platform type error deploying. So files that only support arm platforms on X86CPU devices
To view the Help documentation:
App_abi
By default, the NDK build system would generate machine code for the 'Armeabi' ABI. This corresponds to a armv5te based CPU with software floating point operations. You can use the app_abi to select a different ABI.
For example, to-support hardware FPU instructions on ARMV7 based devices, use:
App_abi: = armeabi-v7a
IA-32 instruction set, use:
App_abi: = x86
Or to support the MIPS instruction set, use:
App_abi: = MIPS
Or to the same time, use:
App_abi: = Armeabi armeabi-v7a x86 MIPS
Or even better, since NDK R7, you can also use the special value 'all ' which means ' all ABIs supported by this ND K release ":
App_abi: = All
For the list of all supported ABIs and details on their usage and limitations, please read cpu-arch-abis.
Create application.mk in the JNI directory specified inside
App_abi: = Armeabi x86
after recompiling, you can see the compilation of two platforms, generating 2. So files
we can see a warning in the compilation process above, which can be found in the APPLICATION.MK Specifies:
App_platform: = android-8
article from : Blog Park /wuyudong
What are the common mistakes of Android JNI development?