Because the company project needs, to carry out the development of JNI, ARR,ACR audio format conversion, later on the project code, now first test the code
One of the references to http://blog.csdn.net/sodino/article/details/41946607 's writing, but some say the good implicit, Bo master groping for one hours, now the details of the detailed sharing to everyone
First of all, to the official download NDK, because Bo Master's machine is Win7 64, bloggers on this address, the rest of the landlord did not check Http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86_64.zip
Small, 500 trillion, but after the decompression to 1 more g, such as slow to endure the download, can not turn over the wall, I believe we all have a way
It is recommended that you put jdk,jnk,tomcat and so on a working hard disk root directory, so as to avoid unnecessary trouble, especially in the directory of Chinese characters, this is disgusting,
Remember the last time you installed the GM simulator because of the path problem tangled for a long period, Bo Master has obsessive-compulsive disorder
Then there is the landlord with the Android studio developed, Eclipse later, Jinzhao project needs, good, early work done, into the topic
Create a new project,
Then open mainactivity, enter the appropriate code, use text to fetch the JNI data
Bo Master named Jni, but accustomed to this window, so the left side of the column will be some letters wiped off the tail, hey
Okay, the next step is to build a directory with Java peers, and the blogger and their name for JNI.
Below began to operate under the terminal window, this step is necessary, do not be afraid of trouble, Bo master before the Wolf has a tiger, really is to bite the bullet to write
This piece of blogger walked a lot of long way, first to open the root directory of your program
CD App/src/main
Emphasis on this, the landlord with the as 1.0 this app must be hit, or you must not go in, prompting you wrong
The front is the absolute path, which can be copied and pasted, the back is the relative path, do not be afraid of trouble, you can test, you can knock
d:\as\jni\app\src\main>javah-d Jni-classpath D:\android-sdk\platforms\android-19\android.jar ... \.. \build\intermediates\classes\debug cn.edu.sjzc.fanyafeng.jni.MainActivity landlord to copy this piece of code, the following can be changed to their own corresponding path
At this point a large segment of the declaration was completed
The. h file is then generated, starting with the. c file. The blogger generates an H file here and does not generate a main.c file. The blogger himself built one, and then the corresponding code was entered
In fact, this is what Java is going to take, and here are some of the ways to write C + +
Then definitely error, JDK words Android Studio will give you the configuration, but JNK need to do their own configuration, then need to open loca.properties, Chinese is local parameters
Double slash line surface do not move, the back of the write absolute path, Bo Master placed in the root directory, save a lot of hearts, hey
And then you might think it's okay, not really.
Start build builds, will definitely error, wrong message bloggers will not wear pictures, because the process, are reported the same error message
Here is the solution, the blogger adopted the first recommendation of the blog method, create a new empty util.c file, and then to build a successful program after the run, so that the program can run up
Successful operation of the program, Bo Master also wrote here, go to the toilet, hey
Using Android studio to prepare for JNI development under Windows