Eclipse、Android NDK、android.mk - 访问被拒绝
Posted
技术标签:
【中文标题】Eclipse、Android NDK、android.mk - 访问被拒绝【英文标题】:Eclipse, Android NDK, android.mk - access denied 【发布时间】:2015-11-12 16:12:31 【问题描述】:我正在尝试使用 NDK 配置 Eclipse。在构建(清理,构建-无论如何)项目期间,我有这个:
13:09:42 **** Clean-only build of configuration Default for project Project ****
"D:\\android\\android-ndk-r10e\\ndk-build.cmd" clean
Access denied - JNI/../../../../PROJECT/SRC
File not found - -NAME
File not found - -PRINTF
File not found - ../../../../PROJECT/SRC/%P \N
Android NDK: WARNING:jni/Android.mk:project: LOCAL_LDLIBS is always ignored for static libraries
[armeabi-v7a] Clean : bullet [armeabi-v7a]
[armeabi-v7a] Clean : freetype [armeabi-v7a]
[armeabi-v7a] Clean : openal [armeabi-v7a]
[armeabi-v7a] Clean : stlport_shared [armeabi-v7a]
[armeabi-v7a] Clean : stlport_static [armeabi-v7a]
[armeabi-v7a] Clean : project [armeabi-v7a]
[armeabi-v7a] Clean : vpx [armeabi-v7a]
13:09:43 Build Finished (took 1s.168ms)
还有我的 android.mk:
LOCAL_PATH:= $(call my-dir)
TARGET_PLATFORM := android-9
include $(CLEAR_VARS)
#include $(LOCAL_PATH)/bullet.mk
LOCAL_MODULE := bullet
LOCAL_SRC_FILES = ../../../../Project/lib_android/lib/$(TARGET_ARCH_ABI)/libbullet.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_MODULE := libvpx
LOCAL_SRC_FILES = ../../../../Project/lib_android/lib/$(TARGET_ARCH_ABI)/libvpx.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := openal
LOCAL_SRC_FILES = ../../../../Project/lib_android/lib/$(TARGET_ARCH_ABI)/libopenal.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := freetype
LOCAL_SRC_FILES = ../../../../Project/lib_android/lib/$(TARGET_ARCH_ABI)/libfreetype.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := project
TARGET_PLATFORM := android-9
OPENGLES_LIB := -lGLESv2
OPENGLES_DEF := -DUSE_OPENGL_ES_2_0
LOCAL_SHARED_LIBRARIES := openal libvpx freetype libbullet
#LOCAL_ARM_MODE := arm
LOCAL_MODULE_FILENAME := libproject
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../../Project/src/ \
$(LOCAL_PATH)/../../../../Project/inc/bullet \
$(LOCAL_PATH)/../../../../Project/inc/ \
$(LOCAL_PATH)/../../../../Project/inc/freetype/include \
$(LOCAL_PATH)/../../../../Project/inc_android/ \
$(LOCAL_PATH)/../../../../Project/inc_android/openal/include \
$(LOCAL_PATH)/../../../../Project/inc_android/openal/OpenAL32/Include \
$(LOCAL_PATH)/../../../src \
#$(error "$(LOCAL_PATH)/../../../../Project/src/")
LOCAL_CPPFLAGS := $(LOCAL_CPP_INCLUDES:%=-I%) -rdynamic -std=c++11
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl -lm -llog \
-lGLESv2 -ldl -llog -lEGL -Wl,-s
cppfiles := $(shell find $(LOCAL_PATH)/../../../../Project/src -name "*.cpp" -printf "../../../../Project/src/%%P \n")
LOCAL_SRC_FILES := $(cppfiles)
include $(BUILD_STATIC_LIBRARY)
我一直在尝试重新安装所有内容、配置权限、移动项目、NDK、SDK,但我什么都没有。我不知道我应该做什么。我被困住了。我错过了什么?
【问题讨论】:
Mb 这很愚蠢,但是...您是否以管理员权限启动 Eclipse? 是的,我做到了,但没有帮助。LOCAL_SRC_FILES =
:= 吗?
哦,确实,我打算写:=。我做了更正,不幸的是它并没有改变任何东西。
【参考方案1】:
我改变了这个:
cppfiles := $(shell find $(LOCAL_PATH)/../../../../Project/src -name "*.cpp" -printf "../../../../Project/src/%%P \n")
LOCAL_SRC_FILES := $(cppfiles)
到这里:
cppfiles := $(wildcard $(LOCAL_PATH)/../../../../Project/src/*.cpp)
LOCAL_SRC_FILES := $(cppfiles:$(LOCAL_PATH)/%=%)
而且它有效。如果要附加位于子目录中的文件,则需要添加符号**
like
src/**/*.cpp
【讨论】:
以上是关于Eclipse、Android NDK、android.mk - 访问被拒绝的主要内容,如果未能解决你的问题,请参考以下文章
将 Android* x86 NDK 用于 Eclipse* 并移植 NDK 演示样例应用
Eclipse、Android NDK、android.mk - 访问被拒绝
eclipse里配置Android ndk环境,用eclipse编译.so文件