转自:http://curran.blog.51cto.com/2788306/506837
今天我给大家演示如何搭建Android NDK
我们到Cygwin的官方网站下载Cygwin的安装程序,地址是: [url]http://www.cygwin.com/setup.exe[/url]
下载完成后,运行运行setup.exe程序,出现安装画面。直接点“下一步”,出现安装模式的对话框,如下图所示:
[img]http://dl.iteye.com/upload/attachment/612267/8236a90d-4d57-38be-85f7-09c0c00f2b08.png[/img]
[img]http://dl.iteye.com/upload/attachment/612265/defcd2b9-4b16-3325-b43a-91de667021db.png[/img]
[img]http://dl.iteye.com/upload/attachment/612269/18aca06f-6a1a-3f00-a009-f08cd72254f6.png[/img]
[img]http://dl.iteye.com/upload/attachment/612271/a7f03234-8786-3bb9-87a1-af5368d14afa.png[/img]
[img]http://dl.iteye.com/upload/attachment/612273/d752b5bd-66e4-3876-b856-e4b715a2ca20.png[/img]
[img]http://dl.iteye.com/upload/attachment/612275/c2161dc7-5255-3887-a58b-9fd1e34dc125.png[/img]
建议选网址是:ftp://mirror.its.uidaho.edu/
[img]http://dl.iteye.com/upload/attachment/612277/669ac779-758f-3821-9b1b-cad24ddcc34c.png[/img]
安装完成桌面生成图标
[img]http://dl.iteye.com/upload/attachment/612293/cd1e2a8f-90ff-333e-93f1-d40a943adcc2.png[/img]
运行Cygwin,我们配置Cygwin,检查gcc,make包是否装上
[img]http://dl.iteye.com/upload/attachment/612279/8f7177d9-adc3-3325-8906-948584a2f860.png[/img]
编译环境需要android-ndk-1.5_r1-windows.zip,解压包,配置包路径
[img]http://dl.iteye.com/upload/attachment/612281/88534b32-0715-3c1f-a9db-8ff6d1c929f8.png[/img]
最后加上ndk引用路径
[img]http://dl.iteye.com/upload/attachment/612283/07c169ed-673c-3893-a321-89093fa26f1e.png[/img]
添加完路径,开始具体操作
[img]http://dl.iteye.com/upload/attachment/612285/d1d4d17e-63a3-3f9e-8324-227e020c8833.png[/img]
接下来是如何运行NDK中自带的samples,首先把android-ndk-1.5_r1\build\out下host目录文件复制到\android-ndk-1.5_r1\out目录文件下,然后编译
[img]http://dl.iteye.com/upload/attachment/612287/98f677f3-effa-363c-b75d-a296878808e5.png[/img]
编译成功
新建Android Project,新建选项中,选择create Project from existing source, 目录选择NDK下的hello-jni目录下的Project文件夹
[img]http://dl.iteye.com/upload/attachment/612289/a6d29c88-2307-3d70-a07f-29720e2523ee.png[/img]
[img]http://dl.iteye.com/upload/attachment/612291/37f97356-fbb6-3018-ac99-1e9ad11d2e5b.png[/img]
今天我给大家演示如何搭建Android NDK
我们到Cygwin的官方网站下载Cygwin的安装程序,地址是: [url]http://www.cygwin.com/setup.exe[/url]
下载完成后,运行运行setup.exe程序,出现安装画面。直接点“下一步”,出现安装模式的对话框,如下图所示:
[img]http://dl.iteye.com/upload/attachment/612267/8236a90d-4d57-38be-85f7-09c0c00f2b08.png[/img]
[img]http://dl.iteye.com/upload/attachment/612265/defcd2b9-4b16-3325-b43a-91de667021db.png[/img]
[img]http://dl.iteye.com/upload/attachment/612269/18aca06f-6a1a-3f00-a009-f08cd72254f6.png[/img]
[img]http://dl.iteye.com/upload/attachment/612271/a7f03234-8786-3bb9-87a1-af5368d14afa.png[/img]
[img]http://dl.iteye.com/upload/attachment/612273/d752b5bd-66e4-3876-b856-e4b715a2ca20.png[/img]
[img]http://dl.iteye.com/upload/attachment/612275/c2161dc7-5255-3887-a58b-9fd1e34dc125.png[/img]
建议选网址是:ftp://mirror.its.uidaho.edu/
[img]http://dl.iteye.com/upload/attachment/612277/669ac779-758f-3821-9b1b-cad24ddcc34c.png[/img]
安装完成桌面生成图标
[img]http://dl.iteye.com/upload/attachment/612293/cd1e2a8f-90ff-333e-93f1-d40a943adcc2.png[/img]
运行Cygwin,我们配置Cygwin,检查gcc,make包是否装上
[img]http://dl.iteye.com/upload/attachment/612279/8f7177d9-adc3-3325-8906-948584a2f860.png[/img]
编译环境需要android-ndk-1.5_r1-windows.zip,解压包,配置包路径
[img]http://dl.iteye.com/upload/attachment/612281/88534b32-0715-3c1f-a9db-8ff6d1c929f8.png[/img]
最后加上ndk引用路径
[img]http://dl.iteye.com/upload/attachment/612283/07c169ed-673c-3893-a321-89093fa26f1e.png[/img]
添加完路径,开始具体操作
[img]http://dl.iteye.com/upload/attachment/612285/d1d4d17e-63a3-3f9e-8324-227e020c8833.png[/img]
接下来是如何运行NDK中自带的samples,首先把android-ndk-1.5_r1\build\out下host目录文件复制到\android-ndk-1.5_r1\out目录文件下,然后编译
[img]http://dl.iteye.com/upload/attachment/612287/98f677f3-effa-363c-b75d-a296878808e5.png[/img]
编译成功
新建Android Project,新建选项中,选择create Project from existing source, 目录选择NDK下的hello-jni目录下的Project文件夹
[img]http://dl.iteye.com/upload/attachment/612289/a6d29c88-2307-3d70-a07f-29720e2523ee.png[/img]
[img]http://dl.iteye.com/upload/attachment/612291/37f97356-fbb6-3018-ac99-1e9ad11d2e5b.png[/img]