在 Eclipse 中设置环境变量以与 Android NDK 一起使用
我在 Windows 上使用 Android NDK 和 cygwin 以及 Eclipse。 在我的 makefile 中,我想使用 eclipse 中的环境变量设置预构建库的路径。 所以我执行以下操作:
在 makefile 中:
LOCAL_SRC_FILES = $(QCAR_SDK_ROOT)build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
LOCAL_EXPORT_C_INCLUDES := $(QCAR_SDK_ROOT)build/include
但我收到错误:
Android NDK: ERROR:jni/Android.mk:QCAR-prebuilt: LOCAL_SRC_FILES points to a missing file
/cygdrive/d/Development/Android/android-ndk-r7/build/core/prebuilt-library.mk:43: *** Android NDK: Aborting . Stop.
make: *** [all] Error 2
Android NDK: Check that jni//cygdrive/D/Development/Android/qcar-android-1-5-4-beta1/build/lib/armeabi/libQCAR.so exists or that its path is correct
尝试直接在 makefile 中定义变量,得到了相同的结果。
所以,显然,这条路不是我想要的。如何设置正确的路径?
I use Android NDK with cygwin with Eclipse on Windows.
In my makefile I want to set path of prebuild library using environment variable in eclipse.
So I do the following:
And in makefile:
LOCAL_SRC_FILES = $(QCAR_SDK_ROOT)build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
LOCAL_EXPORT_C_INCLUDES := $(QCAR_SDK_ROOT)build/include
But I get error:
Android NDK: ERROR:jni/Android.mk:QCAR-prebuilt: LOCAL_SRC_FILES points to a missing file
/cygdrive/d/Development/Android/android-ndk-r7/build/core/prebuilt-library.mk:43: *** Android NDK: Aborting . Stop.
make: *** [all] Error 2
Android NDK: Check that jni//cygdrive/D/Development/Android/qcar-android-1-5-4-beta1/build/lib/armeabi/libQCAR.so exists or that its path is correct
Tried defining variable in makefile directly, got the same result.
So, obviously, that path is not what I wanted. How do I set the proper path?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为什么不在 make 文件中指定路径呢? (注意,刚刚注意到您尝试过。)
Using Cygwin with Android NDK
该站点似乎表明 make 文件无法在 Eclipse 中正确运行,您应该通过 Windows 资源管理器运行。你在 Eclipse 中运行这个吗?尝试一下,看看您是否仍然遇到问题。
Why not just specify the paths in the make file? (N.B Just noticed you tried that.)
Using Cygwin with Android NDK
This site seems to indicate that the make file won't run correctly within Eclipse and you should run in via Windows Explorer. Are you running this within Eclipse? Try this and see if you still get the issues.
这是之前 NDK 版本的问题,Google 通过 NDK-9 修复了这一问题。 “更新了 ndk-build 以支持 LOCAL_SRC_FILES 中的绝对路径。”
请参阅此处的发行说明:http://developer.android.com/tools/sdk /ndk/index.html
That's a problem of the previous NDK builds that Google fixed with NDK-9. "Updated ndk-build to support absolute paths in LOCAL_SRC_FILES."
See the release notes here:http://developer.android.com/tools/sdk/ndk/index.html
尝试使用
LOCAL_PATH
变量。作为文档(Android NDK 包中的docs/ANDROID-MK.html
,或 此处)指出:此外,NDK 会提示您检查 jni//cygdrive/D/Development/Android/qcar-android-1-5-4-beta1/build/lib/armeabi/libQCAR.so 是否存在或它的路径是正确的。
因此,我会尝试以下操作:
...或者完全重置它:
Try to play with
LOCAL_PATH
variable. As documentation (docs/ANDROID-MK.html
in Android NDK package, or here) states:Also, NDK hints you to
Check that jni//cygdrive/D/Development/Android/qcar-android-1-5-4-beta1/build/lib/armeabi/libQCAR.so exists or that its path is correct
.Thus, I would try the following:
...or to reset it at all:
您可以编辑 eclipse.ini 文件并将其添加到其中。
例如
-DLOCAL_SRC_FILES=/home/user/.../
或者声明一个 路径变量。这是在工作空间内的多个项目之间共享公共位置的便捷方法。
希望对您有帮助!
You can edit
eclipse.ini
file and add it there.e.g.
-DLOCAL_SRC_FILES=/home/user/.../
Or declare a path variable. It is a convenient way of sharing a common location among multiple projects within a workspace.
Hope that help you!
Windows 上最新的 NDK 版本不需要 cygwin。更糟糕的是,他们无法识别 cygdrive 符号。您可以简单地使用
更正绝对路径来处理 LOCAL_SRC_FILES 不适用于 ndk.r7,甚至对于 r9,ANDROID-MK.doc 也不鼓励在那里使用绝对路径。
Recent NDK releases on Windows do not need cygwin. Worse, they do not recognize the cygdrive notation. You can simply use
correction absolute paths for LOCAL_SRC_FILES do not work for ndk.r7, and even for r9 the ANDROID-MK.doc does not encourage using absolute paths there.