Android ndk-build 忽略 APP_ABI := x86
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10098049/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android ndk-build ignoring APP_ABI := x86
提问by Code Droid
I'm trying to run NDK to compile native code to run on Atom(x86) processor as well as ARM. No matter how I set APP_ABI, NDK is generating armeabi library. Even if I put only x86 for APP_ABI. And the file size is always the same. here is my Application.mk file:
我正在尝试运行 NDK 来编译本机代码以在 Atom(x86) 处理器和 ARM 上运行。无论我如何设置 APP_ABI,NDK 都在生成 armeabi 库。即使我只为 APP_ABI 放置了 x86。并且文件大小始终相同。这是我的 Application.mk 文件:
LOCAL_PATH := $(call my-dir)
APP_ABI := x86
include $(CLEAR_VARS)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
LOCAL_MODULE := myjni-jni
LOCAL_SRC_FILES := myjni-jni.c
include $(BUILD_SHARED_LIBRARY)
No Matter what I put after APP_ABI I am getting armeabi and its always same size. Whats wrong here? I am using latest NDK.
不管我在 APP_ABI 之后放了什么,我都会得到 armeabi 并且它的大小总是相同的。这里有什么问题?我正在使用最新的 NDK。
回答by Mārti?? Mo?eiko
You should put APP_ABI variable in Application.mkfile not Android.mkfile.
您应该将 APP_ABI 变量放在Application.mk文件而不是Android.mk文件中。
It's written in documentation of NDK (docs/CPU-ARCH-ABIS.html file).
它写在 NDK 的文档中(docs/CPU-ARCH-ABIS.html 文件)。
回答by R?zvan Flavius Panda
If you don't have an Application.mk
file, create one inside jni
folder under project root
.
如果您没有Application.mk
文件,请jni
在project root
.
project_root/jni/Application.mk
project_root/jni/Application.mk
Add target compile platform to it:
向其添加目标编译平台:
APP_ABI := x86
APP_ABI := x86
Or platforms:
或平台:
APP_ABI := armeabi armeabi-v7a x86 mips
APP_ABI := armeabi armeabi-v7a x86 mips
回答by Kukunin
Also you can set APP_ABI
directly to ndk-build
shell command:
您也可以APP_ABI
直接设置为ndk-build
shell 命令:
ndk-build APP_ABI=x86