What are the common mistakes of Android JNI development?

Source: Internet
Author: User
Tags mips instruction set

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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.