gpt4 book ai didi

android - 如何直接从 APK 运行嵌入式 DEX 代码

转载 作者:行者123 更新时间:2023-11-29 23:16:50 26 4
gpt4 key购买 nike

Android Q 的第一个 alpha 版发布。它支持直接从 APK 运行嵌入式 DEX 代码。如何在 gradle 文件中启用它?

最佳答案

根据 android 开发者文档:

You can now tell the platform to run embedded DEX code directly from your app’s APK file. This option can help prevent an attack if an attacker ever managed to tamper with the locally compiled code on the device.

To enable this feature, set the value of the android:useEmbeddedDex attribute to true in the element of your app’s manifest file. You must also build an APK that contains uncompressed DEX code that ART can access directly. Add the following options to your Gradle or Bazel configuration file to build an APK with uncompressed DEX code:

渐变

aaptOptions {
noCompress 'dex'
}

在 list 文件中:

<application
...
android:useEmbeddedDex="true">
...
</application>

Keep in mind that the this attribute is only used in API level 28 and higher.

关于android - 如何直接从 APK 运行嵌入式 DEX 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55196546/

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