Build Android ndk Development Environment

Source: Internet
Author: User

Android applicationsProgramThey are all developed in Java. Android ndk enables us to use C/C ++ native development on AndroidCode.

There are two reasons to use ndk: one is to rationally reuse existing code, and the other is to improve the execution efficiency in some key parts of the program.

For Android ndk development, in addition to the general Android development environment, you also need to download the ndk package and install the cygwin tool (required in Windows ).


Cygwin is a Windows environment similar to Linux. It includes a DLL that provides a basic subset of UNIX functionality and a set of tools above it. (This is not required in Linux)

To install cygwin, follow these steps: setup.exe

Go to official websiteWww.cygwin.comIn the center of the screen is a black-green "C" logo with the title "install or update now .". Click on the link to download a small program setup.exe (250kb ). This installer will guide the cygwin environment installation or update process on your machine. setup.exe to installInstallation, such:
Figure 1. Installation Wizard of cygwin Environment

Select Download location
On this page, select "Install from Internet ".

Figure 2. Select the installation type

Keep clickingNextButton until the page appears:

Select a download site. Because these sites are obligated images, it is risky to select a download point (usually they are available but sometimes unavailable ). Generally, try the site that is closer to you. (There is one fastest)

Select a package for Installation
On this page, you will select the package to install. By default, GCC is not installed in the cygwin basic package. Therefore, you must modify the default settings.
Move the mouse overDevelOn the plus sign (+) of the edge, click it to expandDevelClass.

In this step, we select the component package to be downloaded. To enable cygwin to compile the program, we need to install the GCC compiler. By default, GCC will not be installed, we need to select it for installation. To install GCC, click the "devel" branch in the component list. There are many components under this branch. What we need is:



Click the cycle button in front of the component to display the build version date. Select the latest version for installation. The four types of components are selected:

Binutils component

GCC Components

Gcc-mingw component

GDB Components

AndMake component

After the selection, select next to go to the installation process, as shown in,

After the download is complete, it will be OK!

3. test whether the installation is successful.

Run cygwin and enter make-V and GCC-V. If you can find them, the installation is successful.

Install ndk

It is easy to install ndk. You only need to extract the downloaded ndk file to the specified directory.

Configure ndk

Modify the. bash_profile file under the cygwin directory/home/username and add the following code at the end of the file:

Ndkroot=/Cygdrive/Path of the ndk file (such as ndkroot =/cygdrive/D/Android/ndk)
Export ndkroot

(Note: The ndkroot name can be used by yourself. The path of the ndk file is the path of the ndk after decompression. Note that you should change the Slash to a backslash and remove the path difference between Windows and Linux ))

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.