Android ndk development in Windows

Source: Internet
Author: User

Android ndk provides a series of tools to help developers quickly develop C (or C ++) dynamic libraries, and can automatically package so and Java applications into APK files. Android
Application developers can call C or C ++ local code through ndk. We know that the APK file is easily decompiled. If the program has high security requirements, you need to use ndk. If we want

 

In Windows, you can also develop ndk. The following describes how to configure the environment:

 

1.
Download and decompress the ndk zip package.

2.
Download and install make, make, and cygwin running on Windows, and enter the GCC command to check whether the installation is successful.

3.
Modify
In the. bash_profile file under/cygwin/home/xxxx, add the following two sentences (according to the specific modification in the ndk directory,/cygdrive/D/ ing to the Windows D Drive ):

Android_ndk_root =/cygdrive/D/android-ndk-1.6_r1

Export android_ndk_root

 

After the environment is configured, you can develop the ndk. The development of ndk is no different from the traditional JNI development. However, if the ndk environment is used, dynamic library development can be more convenient. For details about how to develop JNI, refer to many other articles.

 

The following uses the hello-JNI below the compilation sample as an example to illustrate how to generate a dynamic library file.

 

1.
Start CD to enter the hello-JNI directory, and then enter the hello-jni.c file and $ android_ndk_root/ndk-build. If it runs successfully, you will see the build <font
Color = "black" face = "> SO packet prompt information.

$ Android_ndk_root/ndk-build

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

 

The generated so file can be included in the android project for use.

 

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

GL (arui319)

Http://blog.csdn.net/arui319

<This article can be reproduced, but please keep the above author information. Thank you.>

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

 

 

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.