Mac Android NDK First step

Source: Internet
Author: User

1. Download JAVA,NDK,SDK

2.MAC Configure environment variables below, refer to http://mylogo.blog.51cto.com/2963158/1661119

CD ~/can display the environment variables below the current user, then use touch bash_profile to create a file or VI bash_profile edit the environment variable file, configure the path to the NDK and SDK, and use Ndk-build to see if the configuration is successful after the configuration is complete.

If it appears:

Android ndk:could not find application project directory!

Android ndk:please define the Ndk_project_path variable to the it.

/users/vodone/documents/install/android-ndk-r10c/build/core/build-local.mk:148: * * * Android ndk:aborting. Stop.

Description of the configuration has been successful just did not find the corresponding Android project directory

At this point we need to create a new Android project and then add a JNI directory, Add a android.mk file and a helloword.c file to the JNI directory, and then cut the current compilation environment into this Android directory and execute ndk-build.


(1) Place local code on $project/jni/... , such as placing hello.c in the apps/hello/jni/directory (2) in your NDK compilation system to describe your source code (3) in $project/jni/android.mk: in $project/jni/ APPLICATION.MK to your compilation system to describe your project in detail, although you may not need it at the beginning, it allows you to use more CPU or overwrite the compiler/linker tag (4) from your project's directory to start by running "$NDK/ndk-build" To compile your code, or start with a subdirectory (5) The last step can be copied, in case of success, stripping the application sequence of the shared library requires the project root directory of your application. Then you use the usual method to generate the final apk


Mac Android NDK First step

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.