Question

I have a logger module in my project, this has been built as an shared object; so that it can be referenced from different modules in the same project. But facing issues during linking. My folder structure is like

jni
|- Logger (Folder Logger)
|- Module a(Folder a)
|- Module b(Folder b)
|- Module c(Folder c)

Logger has Android.mk file and creating the shared object of the logger. This logger module is being referenced from modules a, b & c. During compilation it is fine, but during linking getting undefined reference to error in all the modules for logger functions. I am referencing them in LOCAL_SHARED_LIBRARIES := logger in other modules. If I try to include the Logger/Android.mk file in the modules then getting error module was already defined. I tried including like LOCAL_LDLIBS := -llogger as well. But no luck :(.

Please let me know if anyone has resolved this issue.

Thanks.

Was it helpful?

Solution

Don't do include of the Logger/Android.mk file in multiple modules. Include the same in the Parent Android.mk file (jni/Android.mk) and in the rest of the modules define in LOCAL_SHARED_LIBRARIES := logger.

My Mistake. I did an include $(LOCAL_PATH)/../Logger/Android.mk in all the other modules as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top