目前是possible将 .dex
类文件动态加载到 Android 的 Dalvik VM 中。这也可能用于 dynamic code generation at runtime .
upcoming ART runtime 是否仍然可行? ?
最佳答案
它似乎与 Dalvik 一样工作。
感谢 matiash 引用 I/O 2014 演讲!我看过the video recording其中,以下是开发人员对运行时代码加载的看法(摘自文字记录):
[Question from the audience:] So I was wondering how ART is going to jive[?] with byte code injection that might happen right after compilation or even at runtime.
[...]
[Answer by Ian Rogers:] So the model that Dalvik has and ART continues is that for class loaders, we have to have everything that the class loader has backed up by a file. So Dalvik never had supports for the kind of doing end memory injection of instructions, and so on.
If you have a file on the disk, then this is something we can do ahead of time compilation for and put into our cache so that we're not regenerating it all of the time. So basically, it works the same way as with Dalvik.
关于android - Android ART 是否像 Dalvik 一样支持运行时动态类加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23739261/