【学习Android NDK开发】搭建Android NDK开发环境(Ubuntu 12.04 LTS 32-bit)
1、安装make build工具
执行以下命令:
sudo apt-get install build-essential
2、下载NDK
官网下载页:http://developer.android.com/tools/sdk/ndk/index.html
选择Linux 32/64-bit (x86)版本,下载
下载成功后,解压到/usr/lib/目录下
3、配置Eclipse插件
a) 搭建SDK开发环境,参考:【学习Android NDK开发】搭建Android SDK开发环境(Ubuntu 12.04 LTS 32-bit)
打开Eclipse,设置NDK路径,Window -> Preferences -> Android -> NDK
b) 右键点击项目,Android Tools -> Add Native Support
前提:Eclipse成功安装ADT
4、调试
a) 更新C/C++ Build配置
右键点击项目,Properties -> C/C++ Build -> Builder Settings
Builder Command,由"ndk-build"添加参数“NDK_DEBUG=1”
In NDK r5, ndk-build has been modified to make it easier to switch between release and debug builds. This is done by using the NDK_DEBUG variable. For example: $NDK/ndk-build NDK_DEBUG=1 => forces the generation of debug binaries $NDK/ndk-build NDK_DEBUG=0 => forces the generation of release binaries If you don't specify NDK_DEBUG, ndk-build will keep its default behaviour, which is to inspect the AndroidManifest.xml, if any, and see if its <application> element has android:debuggable="true". IMPORTANT: If you use the build tools of SDK r8 (or higher), you won't need to touch your AndroidManifest.xml file at all! That's because if you build a debug package (e.g. with "ant debug" or the corresponding option of the ADT plugin), the tool will automatically pick the native debug files generated with NDK_DEBUG=1. Also, as a convenience, the release and debug object files generated by the NDK are now stored in different directories (e.g. obj/local/<abi>/objs and obj/local/<abi>/objs-debug). This avoids having to recompile all your sources when you switch between these two modes (even when you only modified one or two source files).
b) 右击项目,Debug As -> 3 Android Native Application
Android 开发讨论群:84778336
iOS 开发讨论群:82873648

本作品采用知识共享署名-非商业性使用 3.0 许可协议进行许可。
转载请署名李震(博客地址:http://www.cnblogs.com/dyingbleed/),且不得用于商业目的。
博客园博客已停止更新,博客地址:dyingbleed.com
iOS 开发讨论群:82873648

本作品采用知识共享署名-非商业性使用 3.0 许可协议进行许可。
转载请署名李震(博客地址:http://www.cnblogs.com/dyingbleed/),且不得用于商业目的。
博客园博客已停止更新,博客地址:dyingbleed.com
分类:
Android
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?