Example code for compiling Android NDK under linux command line

Source: Internet
Author: User

These days to write an Android runtime to speed up HTML5 Canvas, so that GAMEBUILDER+CANTK not only the development speed, speed can also be close to native applications. So it took a little time to study
Android NDK, the online information is about the IDE's compilation method, here to record the command line under the compilation method, for the needs of friends reference.

Here is an example of compiling HELLO-GL2:

    • 0. Install the Android NDK/SDK, set the PATH variable (depending on the situation)
PATH=$PATH:/work/android/android-sdk-linux/platform-tools/:/work/android/android-sdk-linux/tools/PATH=$PATH:/work/android/android-ndk-r8/build/tools:/work/android/android-ndk-r8/PATH
    • 1. Create a new project with Android
cd /work/android/android-ndk-r8-n-p-a-k com.-t1

The purpose of creating this project is to produce the files required by the ant compilation:

build.xml local.properties project.properties
    • 2. Now that you need to compile the NDK example, copy the files to the corresponding directory. Compile HELLO-GL2 here:
[lixianjing@lixianjing samples]$ cp hello/build.xml hello-gl2/[lixianjing@lixianjing samples]$ cp hello/local.properties hello-gl2/[lixianjing@lixianjing samples]$ cp hello/project.properties hello-gl2/
    • 3. Then compile, first compile the native code with Ndk-build, and then use ant Debug to produce the APK.
[lixianjing@lixianjing hello-gl2]$ ndk-build [lixianjing@lixianjing hello-gl2]$ ant debug

Example code for compiling Android NDK under linux command line

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.