I personally recorded the entire process of calling JNI, and I forgot to save it. Ah.
In some cases, the ndk environment and ndk source code must be prepared. cygwin must be installed with a profile. Java requires environment variables.
1. Create a new project and create a class to declare the method that calls native.PackageCom. Stay. JNI;
Public ClassCallnative {
PublicCallnative (){
}
Static{//Remove the preceding lib from the imported lib name
System. loadlibrary ("Skytech");
}
Public Native Byte[] Readcmd (string path );
Public Native IntWritecmd (Byte[] Cmd, string path );
}
2. Build the project, open cmd, CD to the bin directory of the project,
D: \> Cd D: \ Android \ rayn \ testjni \ bin
D: \ Android \ rayn \ testjni \ bin> javah-JNI com. Stay. JNI. callnative
Then a. h file will appear in the bin directory. This is the declared header file.
3. What we need is the method declared in it. Just change the c file we want to write to the same method name. (I wrote the implementation into the. h file and kept compiling with the. h file .. =)
4. Create a JNI directory in the project and copy the changed C file and MK file (copy one file at will, change the path and Lib name) to the directory.
5. Copy the entire project to the ndk's samples directory (D: \ android-ndk-r5 \ samples)
6. Open cygwin and configure the environment. Open cygwin. bat. . Everything is OK. In this way, JNI can be successfully called.
By the way, I posted a recruitment post: My company (Shanghai Pudong) has a relatively low requirement, but I chose one of the top 50 employees. We are very cautious about recruiting people, but our treatment will never be vague. If you are interested, contact me.
Android job requirements:
1. About one year of experience in developing Android mobile phone platform applications;
2. Develop corresponding functions as required by the project;
3. proficient in Android SDK-based applicationsProgramDevelopment, independent development of various applications;
4. Good team collaboration and strong reading, writing, and communication skills;
5. Hard work, initiative, responsibility, good communication skills, and team spirit;
6. Love the Internet industry and adapt to the growth speed and challenges of entrepreneurial companies.
The following experience is preferred:
1. Have at least one complete R & D experience for user-oriented applications on mobile phones;
2. Rich Java programming experience;
Requirements for iOS: 1. About 1 year of iPhone mobile platform application software development;
2. Be able to develop projects independently and be familiar with iPhone platform interface development and network development;
3. Solid technical skills in the computer technology field, especially in data structures,AlgorithmAndCodeProfound skills in software design;
4. Be interested in new technologies, have strong learning ability, and have the spirit of research and development;
5. Hard work, initiative, responsibility, good communication skills, and team spirit;
6. Love the Internet industry and adapt to the growth speed and challenges of entrepreneurial companies.
The following experience is preferred:
1. Have at least one complete R & D experience for user-oriented applications on mobile phones;
2. Rich Objective C and cocoa programming experience;
What can we bring to you?
1. A free and open working atmosphere.
2. higher salary than your current income.
3. option rewards: We guarantee that our employees can share their benefits while developing the company.