Install and use Android NDK r8d on Windows System (II)

Source: Internet
Author: User

Iv. Integration of the C/D + + development environment in eclipse

1, install the eclipse of A/C + + Environment plug-in: CDT, here choose Online Installation.

First sign in to http://www.eclipse.org/cdt/downloads.php to find the online installation address for your Eclipse version of the CDT plugin.

Helios version of Eclipse installation address: Http://download.eclipse.org/tools/cdt/releases/helios

2. Then click the Help menu to find the Install New software menu

3, click the Add button, take the address to fill in, out of the plug-in list, according to the selected installation on my map line, need other tools, choose, and then choose the next step to complete the installation

4, after the installation is complete, right click on the new project in Eclispe, if a C + + project appears, then your CDT plugin installed successfully!

V. Configuring a C/E + + compiler

1. Open Eclipse, import the NDK Hello-jni example, right-click on the project name, click Properties, pop up the configuration interface, then click Builders, pop Up the project's compilation tool list, then click New, add a compiler, Click on the Add interface, select program, click OK

2, there has been added interface, first to compile a name for the configuration, such as: C_builder

Set location to < your Cygwin installation path >\bin\bash.exe program, for example: E:\cygwin\bin\bash.exe, set working directory to < You cygwin installation path > \ bin directory, for example: E:\cygwin\bin

Set arguments to

--login-c "Cd/cygdrive/e/android-ndk-r5/samples/hello-jni && $NDK/ndk-build"

In the above configuration,/cygdrive/e/android-ndk-r5/samples/hello-jni is the directory of the program you are currently compiling, $NDK is the environment variable of the NDK that was previously configured, the two are configured according to your specific installation directory, the other does not change, Arguments this string of parameters is actually to bash.exe command-line program parameters, enter the program directory to be compiled, and then run the Ndk-build compiler program

Then switch to the Refresh tab and give the refresh resources upon completion a hook

3. Then switch to the Build Options tab and tick the last three items

4, then click the Specify Resources button, select the Resource directory, tick your project directory to

5, finally click Finish, click OK all the way to save the configuration just now, note: If you configure the compiler under other compilers, remember to point up the button to the first, or C code is compiled later than the compilation of Java code, Will cause your C code to compile two times to see the latest changes

6, this all the way down must be very tired, now again congratulate you, compile configuration is also configured to complete, now to test whether you can automatically compile it, open the project JNI directory in the Hello-jni.c file to the hint Hello from jni! to other text: such as: Hello,my Name is Alex, and then run your program in the emulator, if the emulator shows you the latest modified text, then congratulations! You have all the configuration success! If the following error occurs:

The parameter configuration of the interface corresponding to the second figure in the second step is changed to

--login-c "ndk=/cygdrive/f/java_sdk/android-ndk-r8d && export NDK && cd/cygdrive/f/java/hello-jni && $NDK/ndk-build "

The export NDK is the environment variable used to declare the NDK as global

It's finally out!!!

Modify the Hello-jni.c file

Automatically build a new. so file

Start the app again:

This article is from the "Last Night Stars" blog, please make sure to keep this source http://stars.blog.51cto.com/1966388/1193183

Install and use Android NDK r8d on Windows System (II)

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.