How to convert C/C++ source code to static or shared library in android studio and how to link them?

  android-build, android-ndk, android-studio, c++

I am new to Android studio and I mainly rely on c programming language to write programs for Android. I know how to create static or shared C libraries in general but I do not know how to create them in Android studio. how can I access the compiler directly to create or link these libraries? From what I heard until now, Cmake should be involved but I am not sure about it.

So what are the steps to create static or shared libraries in Android studio and what one should do to link them to ones project?

Any help would be appreciated.

Source: Windows Questions C++