Learning Android Chapter 2 NDK translation Summary

Source: Internet
Author: User

This article is very helpful for getting started with NDK. I just ran the code in my environment this evening.

My environment is Fedora14, and my Eclipse for java has also installed CDT to support C and C ++ development.

Previously said to upload the Project address: http://download.csdn.net/source/3464733

Why do we need to write this summary?

I still feel a little necessary. NDK development involves the interaction between Java and C/C ++. Errors and such problems are inevitable during the development process. I am now doing NDK development in linux, which is easier than in Windows.

For beginners, looking for java jni-related articles is not a lot, I have written a: http://blog.csdn.net/lincyang/article/details/6528360

The original Java article about jni written by sun: Compile.

There is a fatal error in the document example, causing compilation failure.

That is, the parameter type defined by the function in the java file is int, and the parameter type in the corresponding function in the header file generated by java becomes long.

This error is already posted on the official website of the book. It is a pity that I did not contact the author directly.

Linc yang-Posted today edit comment

Public static native long fibN (int n );//

    // Native implementation - iterative    public static native long fibNI(int n);  //

But the head file is:... JNIEXPORT jlong JNICALL java_com_marakana_fiber lib_fiber N (JNIEnv, Jclass, jlong);... JNIEXPORT jlong JNICALL java_com_marakana_fiber lib_fiber Ni (JNIEnv, Jclass, jlong );...

There are something wrong. modify: public static native long fibN (long n );//

// Native implementation-iterative public static native long fibNI (long n );//

I hope this article will help you. It is very important to do more technical and communication!

Related Article

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.