简体   繁体   English

如何为NDK_MODULE_PATH指定目录

[英]How to specify directory for NDK_MODULE_PATH

I am having a trouble with this simple task for last couple of hours. 在过去的几个小时里,我遇到了这个简单任务的麻烦。

I have ndk-modules directory in root of my Android project and I have following in my Android.mk of jni folder 我的Android项目的根目录中有ndk-modules目录,我在jni文件夹的Android.mk中有以下内容

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
NDK_MODULE_PATH := $(LOCAL_PATH)/../ndk-modules
...
$(call import-module,mymodule)

When I build the mk file, I got 当我构建mk文件时,我得到了

Android NDK: /MyApp/jni/Android.mk: Cannot find module with tag 'mymodule' in import path    
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?    

What am I doing wrong here? 我在这做错了什么? How can I specify the path correctly? 如何正确指定路径?

UPDATE: 更新:

The specification was right. 规范是对的。 I had a problem in mymodule directory. 我在mymodule目录中遇到了问题。 Sorry for the confusion. 对困惑感到抱歉。

NDK_MODULE_PATH must be in your path. NDK_MODULE_PATH必须在您的路径中。 I wanted to specify it in my Android.mk file so I added this line before the import-module line: 我想在我的Android.mk文件中指定它,所以我在import-module行之前添加了这一行:

$(call import-add-path,my_relative_path)

In my case, I fixed it by realizing NDK searches for: 就我而言,我通过实现NDK搜索来修复它:

$NDK_MODULE_PATH/module_name/Android.mk

But my "module_name" is an Eclipse project where Android.mk is under: 但我的“module_name”是一个Eclipse项目,其中Android.mk位于:

$NDK_MODULE_PATH/module_name/jni/Android.mk

So NDK cannot find it. 所以NDK找不到它。 I fixed it by: 我修复了:

  1. Move module_name/jni/* to "somewhere/module_name". 将module_name / jni / *移动到“somewhere / module_name”。
  2. In Android.mk: 在Android.mk中:

     $(call import-add-path, /path/to/somewhere) $(call import-module,module_name) 

$(调用import-module,mymodule)将搜索$ NDK_MODULE_PATH / mymodule,你可以设置项目顶层的路径或在ndk-modules下创建一个名为mymodule的文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM