Android ndk ndk生成可执行文件未被识别为可执行文件
我只是尝试为一个简单的hello程序进行ndk构建 Android.mk文件:Android ndk ndk生成可执行文件未被识别为可执行文件,android-ndk,ndk-build,Android Ndk,Ndk Build,我只是尝试为一个简单的hello程序进行ndk构建 Android.mk文件: LOCAL_PATH:= $(call my-dir) # Get the local path of the project. include $(CLEAR_VARS) # Clear all the variables with a prefix "LOCAL_" LOCAL_SRC_FILES:=hello.cpp # Indicate the source code. LOCAL_MODULE:= hel
LOCAL_PATH:= $(call my-dir) # Get the local path of the project.
include $(CLEAR_VARS) # Clear all the variables with a prefix "LOCAL_"
LOCAL_SRC_FILES:=hello.cpp # Indicate the source code.
LOCAL_MODULE:= hello # The name of the binary.
LOCAL_ARM_MODE := arm
include $(BUILD_EXECUTABLE) # Tell ndk-build that we want to build a native executable.
Application.mk文件:
APP_ABI := armeabi-v7a # Define the target architecture to be ARM.
APP_STL := gnustl_static
#APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions # This is the place you enable exception.
APP_PLATFORM = android-19
源文件(hello.cpp):
那么,我的设置有什么问题?就是不知道为什么。
提前感谢。似乎是与emulator相关的问题。把它推到Android设备上,它就可以工作了。模拟器可以配置为只运行一种CPU ABI。您的模拟器可能已设置为x86。检查以确保正在Application.mk中构建的ABI与在emulator中配置的ABI匹配。例如,如果您的模拟器正在运行x86: 确保Application.mk文件也设置为相同的值:
APP_ABI := x86
[armeabi-v7a] Compile++ arm : hello <= hello.cpp
[armeabi-v7a] Executable : hello
[armeabi-v7a] Install : hello => libs/armeabi-v7a/hello
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0x3898
Start of program headers: 52 (bytes into file)
Start of section headers: 205324 (bytes into file)
Flags: 0x5000200, Version5 EABI, soft-float ABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 40 (bytes)
Number of section headers: 26
Section header string table index: 25
APP_ABI := x86