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