如何在单个 android.mk 文件中包含多个 .c 文件?
我有 2 个 .c 文件 hello.c 和 world.c 我正在使用 ndk-build。我看到 .so 文件名实际上是“LOCAL_MODULE”的名称。 我如何将这两个文件作为构建的一部分包含在内?
Android.mk 文件
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_SRC_FILES := hello.c / world.c
include $(BUILD_SHARED_LIBRARY)
当我尝试访问任一 c 文件中的方法时,出现以下错误。
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip
file.......] couldn't find "libhello.so" at
java.lang.Runtime.loadLibrary0(Runtime.java:1067)
不知道我应该如何处理这个问题。
I have 2 .c files hello.c and world.c I'm using ndk-build. I see that the .so file name is actually the name of the "LOCAL_MODULE".
How would I include both the files as a part of the build?
Android.mk file
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_SRC_FILES := hello.c / world.c
include $(BUILD_SHARED_LIBRARY)
I'm getting the below error when I try to access methods in either of the c file.
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip
file.......] couldn't find "libhello.so" at
java.lang.Runtime.loadLibrary0(Runtime.java:1067)
Not sure how I should approach this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您有两个名为 native 和 static 的 .c 文件,
cmakelist.txt 文件的结构如下所示
Assuming you have two .c files named native and static,
the structure of the cmakelist.txt file will look like this