我正在尝试为 android 构建一个 hello world 可执行文件。我的test.c:
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello World\n");
return 0;
}
我的安卓.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# give module name
LOCAL_MODULE := hello_world
# list your C files to compile
LOCAL_SRC_FILES := test.c
# this option will build executables instead of building library for android application.
include $(BUILD_EXECUTABLE)
我的应用程序.mk:
APP_ABI := all
我运行了 ndk-build 并在 libs 的单个目录中得到了 7 个可执行文件 - arm64-v8a armeabi armeabi-v7a mips mips64 x86 x86_64 当我运行文件命令时,我得到了
hello_world: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), stripped
但是当我将它推送到 adb shell 并执行它时,我得到一个错误:
not executable: magic 7F45.
我应该怎么做才能让它工作?