How to compile my own C ++ library for Android?

I wrote and tested the library in C ++. The code even works in my Android app if I directly add the source files. Although I have experience compiling static and dynamic libraries for regular operating systems, I have zero compilation experience for such a mobile system. I did some research, and I still lost a little bit on how to get it right. For example, I'm not sure if I need to create a makefile for use with ndk-build or just call one of the Android compilers directly.

I saw this question , but it does not quite correspond to my situation. I just want to run the build and spit out libfoo.a (I would also like to create libfoo.so, but libfoo.a is of great interest to me now.) Example in this question: the winning answer implied that it would build the library in one step / module for creating the final application. I tried to make it so to see, but I was out of luck.

Can someone help me in this endeavor?

CLARIFICATION - I do not want to create a library and immediately connect it to the application. I need a .a or .so file that I can link to in several future Android apps.

+5
source share
2 answers

java , ++ android_main. ndk-build. apk .

. android-ndk-r5/samples, . native-bitmap, .

+3

, ( ?), , - , .

ndk, , . - , android , Makefile, . , Makefile , Android.

+1

All Articles