areful / NdkUseOpenssl

Example code of openssl usage with android NDK.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NdkUseOpenssl

How to build Openssl .so library:

Download Openssl source and run configure script for Android platform, then compile source code. This step makes .so files for Android.

I compile source code on Ubuntu 18.04 amd64 Desktop System, Use command below:

    export ANDROID_NDK=/home/gj/android-ndk-r19c
    export PATH=/home/gj/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
    ./Configure android-arm shared
    make SHLIB_EXT=.so -j8

after build we can copy and save the output .so file.

If want to build .so for other ABIs, you can run 'make clean' and rerun '.Configure' command with ABI argument like this:

	make clean
    ./Configure android-arm64 shared
    make SHLIB_EXT=.so -j8

I built .so files for arm, arm64, armeabi, x86, x86_64 ABI(under directory 'cpp/libs'), and copy armeabi directory as armeabi-v7a, arm64 directory as arm64-v8a, for Android Studio not support armeabi, arm64 ABI any more. See build.gradle file, section 'abiFilters'.

About

Example code of openssl usage with android NDK.

License:Apache License 2.0


Languages

Language:C 98.2%Language:C++ 1.4%Language:Java 0.2%Language:Shell 0.1%Language:CMake 0.1%