gpt4 book ai didi

android - gradle + ndkbuild + android studio 2.2 如何设置支持的 ABI?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:13:51 30 4
gpt4 key购买 nike

我想使用 android studio 与 ndkbuild 的集成。

我的项目构建的“本地”部分仅适用于 armeabi-v7a-hard 和 x86,如果我只是在 jni 目录中运行 ndk-build ,一切正常。我在 Application.mk 中有正确的行:

APP_ABI := armeabi-v7a-hard x86

为了将项目集成到 android studio 中,我在 build.gradle 中添加了这样的行:

externalNativeBuild {
ndkBuild {
path 'src/lib/jni/Android.mk'
}
}

但出于某种原因 gradle build 尝试使用 APP_ABI=armeabi 构建 native 代码但失败了,因为我的代码只能使用 armeabi-v7a- 构建很难

那么我如何告诉 gradle 只为 armeabi-v7a-hardx86 构建我的代码,或者只是不忽略 Application.mk 中的 APP_ABI 行?

我尝试这样的变体:

defaultConfig {
ndk {
abiFilters 'x86', 'armeabi-v7a-hard'
}
}

但是 gradle 失败并显示这样的消息:

ABIs [armeabi-v7a-hard] are not available for platform and will be excluded from building and packaging. Available ABIs are [armeabi, armeabi-v7a, arm64-v8a, x86, x86_64, mips, mips64].

请注意,我使用的是 ndk 10,而不是最后一个 (ndk 13),其中 armeabi-v7a-hard 中的 ndk.dir local.properties 正确的值。

最佳答案

@Titan 提供的链接是设置 ABI 所需的全部内容。

它可能不起作用的原因是因为 armeabi-v7a-hard 在 2015 年已被弃用,因此以它为目标会导致此问题。您应该按照此 this post 定位 armeabi-v7a

关于android - gradle + ndkbuild + android studio 2.2 如何设置支持的 ABI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40993786/

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