As libssh does not provide official android support, compiling it for Android is a bit tricky. In this post, I’m providing my solution. Boringssl is used as the ssl lib.
The building script is developed for Linux but could be easily adapted for Windows, I think.
libssh android build scripts along with all the other stuff can be found here.
Compiled libssh and boringssl libs git repository can be found here.
The solution is based on a project called multipass (https://github.com/CanonicalLtd/multipass/tree/master/3rd-party/libssh) and some posts from https://www.libssh.org/archive/libssh/2015-11/0000011.html
The multipass project uses its own libssh, which is pretty much the same thing.
Using the libs in a cmake project looks like:
target_link_libraries(pcapremote
${log-lib}
${PROJECT_SOURCE_DIR}/ext_libs/${ANDROID_ABI}/libssh.a
${PROJECT_SOURCE_DIR}/ext_libs/${ANDROID_ABI}/libssl.a
${PROJECT_SOURCE_DIR}/ext_libs/${ANDROID_ABI}/libcrypto.a
${PROJECT_SOURCE_DIR}/ext_libs/${ANDROID_ABI}/libdecrepit.a
${PROJECT_SOURCE_DIR}/ext_libs/${ANDROID_ABI}/libssh-boringssl-compat.a
${z-lib})
Make sure you link libssh-boringssl-compat.a lib to your project.