Android NDK开发遇见的Cannot find module with tag 'cpufeatures' in import path解决方法

1. 我的Android.mk文件如下:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test #构建生成的so动态库的名称
LOCAL_SRC_FILES := test.c #这个文件里使用到cpufeatures
LOCAL_CFLAGS := -DHAVE_NEON=1  #NEON flag
LOCAL_STATIC_LIBRARIES := cpufeatures  #引入cpufeatures这个静态库
LOCAL_LDLIBS := -llog  #log动态库,-l + log库名称
include $(BUILD_SHARED_LIBRARY)  #构建so动态库
$(call import-module,cpufeatures)  #导入cpufeatures

2. 遇到的错误:

Android NDK: ...\Android.mk: Cannot find module with tag 'cpufeatures' in import path   #说在导入的路径里找不到cpufeatures
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
process_begin: CreateProcess(NULL, "", ...) failed.

 

3. 解决方法:

我的AndroidStudio的local.properties的NDK路径:ndk.dir=C\:\\Android\\sdk\\ndk-bundle

我的电脑的cpufeatures模块的路径:C:\Android\sdk\ndk-bundle\sources\android\cpufeatures

一对比我把Android.mk的最后一行$(call import-module,cpufeatures) 改为 $(call import-module,sources/android/cpufeatures) 还是不行。

 

最后我把Android.mk的最后一行$(call import-module,cpufeatures) 改为 $(call import-module,android/cpufeatures) ,也就是去掉sources,编译成功,问题解决。

 

随便贴一下Application.mk的简单配置
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-16

 

posted @ 2018-03-13 15:10  yongfengnice  阅读(1174)  评论(0编辑  收藏  举报