Android ndk environment Configuration

Source: Internet
Author: User

1. Download The ndk and decompress it.
2. Install cywin

: Http://cygwin.com/
Cygwin is a Linux simulated environment. Android ndk development currently does not support directly compiling C language files under windwos. Android is a Linux kernel-based system. For more information about the installation process, see cygwin. The required component gun make 3.81 or the updated version must be used to compile the c file. If you are not familiar with Linux, simply install all the components in the devel directory. You can also download the Components Package of the platform to your local device for installation. For more information, see.
Install cygwin. bat will display a command line window for Linux Shell. Test the GNU make version: Make-V. If the window shows the GNU make version (eg: GNU make 3.8.1), the installation is successful.
 
3. Configure cywin and ndk
The simplest configuration method is to configure cygwin environment variables in the same way as that in windows. Configure the environment variable to only the root directory of Android ndk, assuming Android ndk root Location D:/android-ndk-r5
Android_root = D:/android-ndk-r5
Path = % android_root %
When cygwin is started, all windows environment variables are loaded by default. After configuration, you can run the ndk-build compilation command.
 
4. recompile hello-JNI for testing
Navigate to the hello-JNI sample folder.
$ CD $ android_root/samples/Hello-JNI (note the difference between referencing system environment variables and Windows)
Run ndk-build Compilation
 
$ Ndk-build
Compilation information:
Gdbserver: [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup: libs/armeabi/GDB. Setup
Compile thumb: hello-JNI <= hello-jni.c
Sharedlibrary: libhello-jni.so
Install: libhello-jni.so => libs/armeabi/libhello-jni.so
$ Ndk-buildgdbserver: [arm-linux-androideabi-4.4.3] libs/armeabi/gdbservergdbsetup: libs/armeabi/GDB. setupcompile thumb: hello-JNI <= hello-jni.cSharedLibrary: libhello-jni.soInstall: libhello-jni.so => libs/armeabi/libhello-jni.so
This process will compile the hello-jni.c into the. So file, to which the android ndk development environment is configured successfully.

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.