Install Android ndk C ++ on Ubuntu 13.04x64

Source: Internet
Author: User
Tags intl

Operating System: Ubuntu 13.04x64

Objective: To install Android ndk C ++

Install Android SDK

Due to device management, such as ADBProgramIn the android SDK, you must first install the SDK (platform tools and at least one version of Android API is required ).

Http://www.cnblogs.com/sink_cup/archive/2011/10/31/ubuntu_x64_android_sdk_java.html

Install Android ndk

Download unzip Android ndk: http://developer.android.com/sdk/ndk/index.html

Install ant

Android uses ant for packaging, so installation is required.

 
SudoApt-GetInstall-Y ant
Install JDK

Ant needs JDK instead of JRE. Otherwise an error will be prompted:/usr/lib/JVM/java-7-openjdk-amd64/lib/tools. jar is required

 
SudoApt-GetInstall-Y openjdk-7-JDK

 

Compile an android C ++ Program

reference: http://developer.android.com/intl/zh-CN/tools/sdk/ndk/index.html#native-activity

EchoSelect an example CD android-Ndk-r8e/samples/Native-ActivityEchoGenerate the build. xml file Android update project-P.-S-T4Echo-T4Is the meaning of Target 4, which can be viewed using Android list targets. If the android API in the SDK is not installed, the targets is empty.EchoCompile ../../Ndk-BuildEchoPackage ant debugEchoInstall ADB on a mobile phone or virtual machineInstallBin/NativeActivity-debug.apk

If multiple devices are connected, select one device for installation and debugging.

ADB devicesadb-S 344f722eInstallBin/NativeActivity-debug.apk

 

Start Android C ++ Hello World

Android can use C ++ in two ways:

Official documents: http://developer.android.com/intl/zh-CN/tools/sdk/ndk/index.html#Using

(1) develop a dynamic link library in C/C ++ and call it in the form of JNI in Java. For example, hello-JNI in the official example

Demo step: http://www.cnblogs.com/tanlon/archive/2011/09/04/2166719.html

Reference: http://developer.android.com/sdk/ndk/index.html#gettingstarted

(2) fully develop apps using C/C ++. For example, native-activity in the official example

Todo

Reference: http://coolshell.cn/articles/3549.html

Http://www.oschina.net/code/snippet_12_2904

Http://developer.android.com/reference/android/app/NativeActivity.html

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.