- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
EMBEDDED SYSTEMS
PROGRAMMING 2012-13
Application Basics for Android: the NDK
WHAT IS THE NDK?
The Android NDK is a set of cross-compilers, scripts
and libraries that allows to embed native code into
Android applications
Native code is compiled from C/C++ sources
Requires Android 1.5 (API level 3) or later
NATIVE CODE: WHY? (1/2)
Reason #1: you already have a native-code library,
and wish to make it accessible to Java code without
rewriting it
NATIVE CODE: WHY? (2/2)
Reason#2: native code might be faster than bytecode
Bytecode recompiled by a fast JIT compiler;
overheads in passing parameters
From Google’s documentation:
...you should understand that the NDK will not benefit most apps. As a developer,
you need to balance its benefits against its drawbacks. Notably, using native code
on Android generally does not result in a noticeable performance improvement, but
it always increases your app complexity. In general, you should only use the NDK if
it is essential to your app—never because you simply prefer to program in C/C++
NDK: WHAT IS INCLUDED
Cross-compilers for ARMv5TE, ARMv7-A, x86 and
MIPS architectures
Native libraries (with corresponding header files)
that are “stable”, i.e., guaranteed to be supported in the
future.
Among the libraries: libc, libm, libz, OpenGL ES libs, ...
A custom build system to ease the specification of
how your C/C++ code should be compiled linked
Documentation and examples (of course)
APPROACHES TO NATIVE
CODE
With the Android NDK there are currently two
approaches to native code development
JNI: the application is mostly written in Java. The
(few) methods written in C/C++ are accessed via the
Java Native Interface
Native activity: entire activities are implemented
in C/C++.
Supported in Android 2.3 (API Level 9) or later
JNI (1/5)
The Java
您可能关注的文档
最近下载
- 家政讲师师资培训课件.ppt
- 细菌群体感应信号分子及其检测方法.docx VIP
- 【基于企业作业成本法的企业成本控制研究的国内外文献综述4000字】.docx VIP
- 2025年中级注册安全工程师之安全生产技术基础题库(考试直接用).docx VIP
- 10.2捍卫国家利益课件.pptx VIP
- 2025年中级注册安全工程师之安全生产技术基础题库及参考答案【考试直接用】.docx VIP
- 人教版物理九年级上册《第十六章 电压 电阻》大单元整体教学设计.docx
- 中文书名《我的姐姐罗莎琳·富兰克林》.doc VIP
- 2025年中级注册安全工程师之安全生产技术基础考试题库附参考答案【考试直接用】.docx VIP
- 【MOOC期末】《中国马克思主义与当代》(北京科技大学)期末慕课答案.docx VIP
文档评论(0)