Jim Rhodes
Jim Rhodes

Reputation: 5085

Cannot build static library with Android NDK R8

I have been building a shared library with the Android NDK and now want to build it as a static library. I assumed that all I had to do was change BUILD_SHARED_LIBRARY to BUILD_STATIC_LIBRARY in Android.mk but now when I run ndk-build, absolutely nothing happens. It just comes right back to the command prompt without displaying anything. I tried ndk-build -n and it shows 3 rm commands being executed and nothing else. I tried ndk-build -B and it makes no difference. I tried ndk-build -d and there is nothing in the output related to my source files or the name of the library.

If I change the make file back to build the shared library, it compiles the source and links the .so with no problems.

Anyone have any ideas what could be wrong?

Upvotes: 5

Views: 2524

Answers (1)

Jim Rhodes
Jim Rhodes

Reputation: 5085

It seems that in order to build a static library, it must be a dependency of something. I was able to build my library as static by adding an Application.mk file with the following line:

APP_MODULES = mylib

Upvotes: 5

Related Questions