Android development-ndk Development

Source: Internet
Author: User

Note: This article is not original. I have referred to the articles of several predecessors. This article is just a bit organized.

Reference 1: configure the ndk_r4 development environment in eclipse (Integrating cygwin and CDT)

This section describes how to configure eclipse Automatic Compiling ndk in Windows and Linux respectively.

Refer to 2: Android ndk Development Environment Configuration

This section describes the configuration of the new ndk.

Reference 3: The best ndk entry-level project in history

The development process of ndk helloworld is introduced in detail, but the ndk version is old and the compilation method is different.

1. What is ndk?

Ndk is a collection of tools used by Android applications to call local code. We all know that android applications run on DVM. Using ndk, we can implement direct calls to local code (C, C ++) by applications ). This improves the running efficiency of applications and provides a better user experience.

Ii. helloworld for ndk

1. Download android-ndk-r4b

: Android-ndk-r4b-windows.zip

There are many differences between the new ndk version and the old version. For details, refer to 2 and 3.

2. Download cygwin. To simulate the Linux environment in windows, ndk-build is based on Linux. Cygwin is not required for Linux.

........................ (For details, see the above three references)

Iii. Notes

This is the content of the android. mk file.

   1: LOCAL_PATH := $(call my-dir)
   2:  
   3: include $(CLEAR_VARS)
   4:  
   5: LOCAL_MODULE    := jniDemo
   6: LOCAL_SRC_FILES := com_halzhang_android_jni_Jni.c
   7:  
8: # If it is configured as include $ (build_static_library), compilation will fail.
   9: include $(BUILD_SHARED_LIBRARY)

 

Oh, that's it. If you have any questions, please leave a message!

Original

Note: This article is not original. I have referred to the articles of several predecessors. This article is just a bit organized.

Reference 1: configure the ndk_r4 development environment in eclipse (Integrating cygwin and CDT)

This section describes how to configure eclipse Automatic Compiling ndk in Windows and Linux respectively.

Refer to 2: Android ndk Development Environment Configuration

This section describes the configuration of the new ndk.

Reference 3: The best ndk entry-level project in history

The development process of ndk helloworld is introduced in detail, but the ndk version is old and the compilation method is different.

1. What is ndk?

Ndk is a collection of tools used by Android applications to call local code. We all know that android applications run on DVM. Using ndk, we can implement direct calls to local code (C, C ++) by applications ). This improves the running efficiency of applications and provides a better user experience.

Ii. helloworld for ndk

1. Download android-ndk-r4b

: Android-ndk-r4b-windows.zip

There are many differences between the new ndk version and the old version. For details, refer to 2 and 3.

2. Download cygwin. To simulate the Linux environment in windows, ndk-build is based on Linux. Cygwin is not required for Linux.

........................ (For details, see the above three references)

Iii. Notes

This is the content of the android. mk file.

   1: LOCAL_PATH := $(call my-dir)
   2:  
   3: include $(CLEAR_VARS)
   4:  
   5: LOCAL_MODULE    := jniDemo
   6: LOCAL_SRC_FILES := com_halzhang_android_jni_Jni.c
   7:  
8: # If it is configured as include $ (build_static_library), compilation will fail.
   9: include $(BUILD_SHARED_LIBRARY)

 

Oh, that's it. If you have any questions, please leave a message!

Original

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.