Ndk windows Configuration

Source: Internet
Author: User

Today, we finally completed the configuration of ndk on Windows, unlocking the mystery. Sending a blog as a reward is recorded.

 

1. Go to www.cygwin.com and select install to download setup.exe, which is about 549kb.

2. Use setup.exe to download cygwin. Follow the prompts and proceed step by step. The download process is slow. We recommend that you try more. It took me about three hours to download it. Note: In the Select installation item, click to switch to the devel install status. At first, I didn't care about it. It won't work in the future.

3, download Android ndk, http://developer.android.com/sdk/ndk download, unzip it.

 

Configure cygwin

 

Set Environment Variables

First, find the. bash_profile file in the installation path. My environment is located at: C:/cygwin/home/administrator. Use

Ultraedit or editplus is enabled. Do not open it in Notepad. Add the following two sentences:

Android_ndk_root =/cygdrive/e/develop/Android-ndk/android-ndk-1.5_r1

Export android_ndk_root

 

The previous sentence needs to be modified to your own path. Save the statement and restart cygwin.

E/develop/Android-ndk/android-ndk-1.5_r1 is your own installation path

 

Note: If the Chinese OS uses notepad or WordPad to open and edit the file, an error is returned when cygwin is restarted. Yes

 

Here cygwin is configured. The latest android-ndk-r4b, is not required for other configurations, the lower version also requires configuration under./host-setup.sh

 

The configuration is completed ...............................

Reference article: The seventh ndk of eoeandroid special publication, which uses the old ndk version, so it must be changed flexibly.

 

--------------------------------------------------------------------

Test how to use:

. Create an android project named hello-JNI and copy the hellojni. Java and JNI directories from ndk/samples/Hello-JNI.
Right-click the project, select Properties, select builder, new, select program, and click OK.
In the new window, enter the following content:
Location: H:/cygwin/bin/bash.exe
Working directory: H:/cygwin/bin/
Arguments: -- login-c "CD/cygdrive/e/boss-workspace/Hello-JNI & $ android_ndk_root/ndk-build"
H:/cygwin is the installation directory of cygwin, and E/boss-workspace/Hello-JNI is the project directory.
Select refresh on the tab,

 

Note that when specify working set of relevant resources is checked, specify the resource to select the JNI directory of your project.

 

When the above steps are correctly configured, after saving the configuration, the C-related code under the JNI directory should be automatically compiled and output accordingly. so library files are stored in the libs directory of the project. The libs directory is automatically created.

 

Note: ndk-build cannot be found in the console at the beginning, and argument is written:
-- Login-c "CD/cygdrive/e/boss-workspace/Hello-JNI &/cygdrive/e/software/android-ndk-r4-windows/android-ndk-r4/ndk-build ",
And clean. The system will automatically re-compile and the compilation is successful.

 

Http://wingjang.blog.163.com/blog/static/47913442201101764354578/

As shown in the preceding example, files such as lib and OBJ are successfully generated and the program runs properly.

 

Thanks to the Party, the country, and the network ....

 

Next day, let's take a closer look at JNI... Come on.

 

 

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.