Android · 2015年1月8日 0

AndroidNDK开发环境介绍

AndroidNDK开发环境介绍

一.系统和软件需求
1.AndroidSDK
一个完整的Android SDK安装(包括所有附件)是必需的
Android 1.5 以上SDK
2.支持的操作系统
Windows XP (32-bit) or Vista (32- or 64-bit)
Mac OS X 10.4.8 or later (x86 only)
Linux (32 or 64-bit; Ubuntu 8.04, or other Linux distributions using GLibc 2.7 or later)
3.需要的开发工具
所有开发平台都需要GNU Make3.81以上版本
需要最新版本的AWK( GNU Awk 或者Nawk)
对于Windows,需要Cygwin 1.7以上的版本(注意:Cygwin1.5是不行的)
4.Android平台兼容性
创建的本地库Android NDK只能运行特定的最低设备使用Android平台版本,平台所需的最低版本取决于您的目标设备的CPU架构。
下面的表细节的Android平台版本兼容本地代码开发特定的CPU架构。
CPU架构 兼容的平台
ARM, ARM-NEON Android 1.5 以上
x86 Android 2.3 以上
MIPS Android 2.3 以上
为了保证平台兼容性需要设置<uses-sdk>的android:minSdkVersion 例如<uses-sdk android:minSdkVersion=”3″ />
NDK使用OpenGL ES APIs,为了确保平台的兼容性,需要设置<uses-sdk>的android:minSdkVersion
下面给出对应关系
OpenGL ES 版本 兼容平台 需要的最小SDK
OpenGL ES 1.1 Android 1.6 以上 android:minSdkVersion=”4″
OpenGL ES 2.0 Android 2.0 以上 android:minSdkVersion=”5″
另外一个应用使用OpenGL ES,在manifest文件中应该声明<uses-feature>的 android:glEsVersion(OpenGL的最小版本)
例如<uses-feature android:glEsVersion=”0x00020000″ />
NDK中使用API访问Bitmap相关操作,需要设置Android的最小SDK为8.
英文原文
If you use this NDK to create a native library that uses the API to access Android Bitmap pixel buffers or utilizes native activities, the application containing the library can be deployed only to devices running Android 2.2 (API level 8) or higher. To ensure compatibility, make sure that your application declares <uses-sdk android:minSdkVersion=”8″ /> attribute value in its manifest.

二.安装NDK
1.下载最新的Android SDK或则更新到最新的Android SDK
2.下载NDK和安装(下面简单不翻译了)
Linux and Mac OS X (Darwin):
Download the appropriate package from this page.
Open a terminal window.
Go to the directory to which you downloaded the package.
Run chmod a+x on the downloaded package.
Execute the package. For example:

ndkchmod a+x android-ndk-r10c-darwin-x86_64.bin
ndk
./android-ndk-r10c-darwin-x86_64.bin

The folder containing the NDK extracts itself.

Note that you can also use a program like 7z to extract the package.

On Windows:
Download the appropriate package from this page.
Navigate to the folder to which you downloaded the package.
Double-click the downloaded file. The folder containing the NDK extracts itself.
When uncompressed, the NDK files are contained in a directory called android-ndk-<version>. You can rename the NDK directory if necessary and you can move it to any location on your computer. This documentation refers to the NDK directory as <ndk>.

You are now ready to start working with the NDK.
注意:在windows上下载的android-ndk-r10d-windows-x86_64.exe这种,点击运行后,发现没有android-ndk-r10d文件夹的话,请放android-ndk-r10d-windows-x86_64.exe在非中文文件目录中或则直接放到硬盘根目录(例如D:)。

Share this: