gpt4 book ai didi

android - 使用 Art 代替 Dalvik 编译

转载 作者:行者123 更新时间:2023-11-29 15:57:45 25 4
gpt4 key购买 nike

我正在使用 Eclipse,我有一个使用 android 版本 21 (5.0) 的新项目。我想用 Art 而不是 Dalvik 来编译它。我必须做些什么才能实现这一目标?

编辑:问题的原因是我有这个问题:

[2014-11-12 10:30:49 - Dex Loader] Unable to execute dex: method ID not in [0, 0xffff]: 65536
[2014-11-12 10:30:49 - MAMUT] Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

我希望这样做能解决问题:

Of particular note is the suggestion of making a minSdkVersion 21 dev build - this allows you to generate multi-dex output incrementally in the new ART format, making for a much faster development iteration cycle (at least on Android 5.0 devices).

谢谢

最佳答案

Of particular note is the suggestion of making a minSdkVersion 21 dev build - this allows you to generate multi-dex output incrementally in the new ART format, making for a much faster development iteration cycle (at least on Android 5.0 devices).

这是错误的,应该粗略地阅读

Of particular note is the suggestion of using Android Build Tools 21.1 and higher together with the Multidex Support Library - this allows you to use multiple dex files in the dex format which hasn't changed at all, making for unchanged development.

dex 格式的问题在于它不能包含超过 65536 个方法。解决方案是简单地将输出拆分为多个 dex 文件。我们过去有 2 个问题

  • dx 工具无法生成多个 dex 文件
  • 在一台设备上使用多个 dex 文件非常复杂,因为设备只加载 1 个 dex 文件,而其他文件中的代码必须以某种方式手动加载。

Build tools 21 解决了第一个问题,只需在编译选项中添加-multi-dex 标志即可生成多个dex 文件。

multidex 支持库解决了第二个问题。它告诉那些设备如何加载额外的 dex 文件。 Lollipop 及更高版本上的 ART 运行时(4.4 也有 ART 但不能做同样的事情)能够使用多个文件而无需被告知如何使用。

同样相关的还有官方Building Apps with Over 65K Methods文档。

关于android - 使用 Art 代替 Dalvik 编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26883537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com