When Android calls JNI, java. Lang. unsatisfiedlinkerror appears.

Source: Internet
Author: User

Depressing: when calling JNI, there will always be // 08-14 10:26:28. 734: Error/androidruntime (30101): Java. Lang. unsatisfiedlinkerror: writecmd

After a morning, I finally couldn't help it. I asked in the group that I had made a mistake. I compiled a. h file, not a. c file .... Tragedy.

Call the JNI step,

1. Write the Java and native methods and call the Lib name.

2. Run cmd CD to the bin directory of the project. javah-JNI all-inclusive name + class name to get the. h header file.

3. Copy the. H header file method to the. c file.

4. Copy A. mk file to the JNI directory of the project and modify the Lib name and the compiled file name.

5. Copy the project to the ndk sample directory and compile it with cygwin,

6. Run the project and get everything done

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.