Android ndk: utils/Log.h: 没有这样的文件或目录编译终止

Android ndk: utils/Log.h: No such file or directory compilation terminated

本文关键字:文件 终止 编译 utils ndk Log Android      更新时间:2023-10-16

正在编译Android NDK项目,但无法成功完成。它说在 main.cpp 文件中找不到这样的文件或目录的日志头文件。我是安卓NDK的新手,请帮忙。这是我 android.mk 文件。

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := user
LOCAL_ARM_MODE := arm
# This is the target being built.
LOCAL_MODULE := libemu
# All of the source files that we will compile.
LOCAL_SRC_FILES := 
    ticks.c 
    main.cpp 
    emulator.cpp
# All of the shared libraries we link against.
LOCAL_SHARED_LIBRARIES := 
    libdl 
    libnativehelper 
    libutils
# Static libraries.
LOCAL_STATIC_LIBRARIES :=
# Also need the JNI headers.
LOCAL_C_INCLUDES += 
    $(JNI_H_INCLUDE)
# Special compiler flags.
LOCAL_CFLAGS += -O3 -fvisibility=hidden
# Don't prelink this library.  For more efficient code, you may want
# to add this library to the prelink map and set this to true. However,
# it's difficult to do this for applications that are not supplied as
# part of a system image.
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)

这是日志

"Compile++ arm  : emu <= main.cpp
D:/EclipseWorkspace/NineTendo//jni/main.cpp:2:23: fatal error: utils/Log.h: No such file or directory
compilation terminated.
make: *** [D:/EclipseWorkspace/NineTendo//obj/local/armeabi/objs/emu/main.o] Error 1

任何帮助将不胜感激。谢谢

此错误

开始出现在NDK版本R9x中。您需要在 Application.mk 文件中声明 API 版本号。以下是定义最低 API 级别 8 的外观:

APP_PLATFORM := android-8

Application.mk 文件应与 JNI 目录中的 Android.mk 文件一起存在。这是我的一个项目的示例:

APP_ABI := armeabi armeabi-v7a x86
APP_CFLAGS += -O2
LOCAL_ARM_MODE  := arm
APP_PLATFORM := android-8