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!