ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

java – android platfrom,Dalvik字节码或本地机器代码过程中的哪种代码?

2019-07-05 20:51:01  阅读:194  来源: 互联网

标签:java android linux dalvik android-runtime


我不太确定在android平台上的linux进程中加载​​了哪种代码.

如果android采用Dalvik,该进程包含Dalvik VM和应用程序的代码,是Dalvik字节码形式的代码吗?如果是,代码是否与.apk文件中的classes.dex相同?

如果android采用Android Runtime(ART),因为classes.dex已被翻译成本机机器码,所以我认为Linux进程中的应用程序代码不是Dalvik字节码,而是本机机器码.如果我的理解是对的,那么Dalvik VM仍然包含在这个过程中吗?

解决方法:

从Android 5.0(Lollipop)开始,Dalvik已完全被Android Runtime(ART)取代,后者处理原生二进制文件.

Verifying App Behavior on the Android Runtime

The Android runtime (ART) is the default runtime for devices running Android 5.0 (API level 21) and higher.


At install time, ART compiles apps using the on-device dex2oat tool. This utility accepts DEX files as input and generates a compiled app executable for the target device

更具体地说,Dalvik推广使用odex文件,这些文件是Dalvik的dex文件的预处理优化版本,可以解释或JIT编译.

ART促进了ELF文件的使用,ELF文件是一种通用格式,用于指导将某些功能和对象链接到设备的本机指令,并在安装时执行.

Wikipedia – Android Runtime

Unlike Dalvik, ART introduces the use of ahead-of-time (AOT) compilation by compiling entire applications into native machine code upon their installation.


ART uses the same input bytecode as Dalvik, supplied through standard .dex files as part of APK files, while the .odex files are replaced with Executable and Linkable Format (ELF) executables. Once an application is compiled by using ART’s on-device dex2oat utility, it is run solely from the compiled ELF executable

Executable and Linkable Format – Applications

Android uses ELF .so (shared object) libraries for the Java Native Interface. With Android Runtime (ART), the default since Android 5.0 “Lollipop”, all applications are compiled into native ELF binaries on installation

ART不包含Dalvik的实例,虽然大多数都是兼容的,但是提到了不支持Dalvik支持的某些功能.

Verifying App Behavior on the Android Runtime

However, some techniques that work on Dalvik do not work on ART. This document lets you know about things to watch for when migrating an existing app to be compatible with ART. Most apps should just work when running with ART.

标签:java,android,linux,dalvik,android-runtime
来源: https://codeday.me/bug/20190705/1390569.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有