git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
mkdir build_lib
cd build_lib
cmake ..
make
# it will print paths for google glog, eigen3, sparse etc, we will use them for android build
cd /path/to/ceres-solver # cloned directory
mkdir build_android_armeabi-v7a
cd build_android_armeabi-v7a
cmake -DCMAKE_TOOLCHAIN_FILE=$HOME/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake \
-DBUILD_SHARED_LIBS=ON \
-DANDROID_STL=c++_shared \
-DANDROID_ABI=armeabi-v7a \
-DANDROID_NATIVE_API_LEVEL=android-28 \
-DEigen3_DIR=/opt/homebrew/share/eigen3/cmake \
-DMINIGLOG=ON \
..
make
# Now you can find libceres.so inside libs folder
cd /path/to/ceres-solver # cloned directory
mkdir build_android_arm64_v8a
cd build_android_arm64_v8a
cmake -DCMAKE_TOOLCHAIN_FILE=/Users/vemarav/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake \
-DBUILD_SHARED_LIBS=ON \
-DANDROID_STL=c++_shared \
-DANDROID_ABI=arm64-v8a \
-DANDROID_NATIVE_API_LEVEL=android-28 \
-DEigen3_DIR=/opt/homebrew/share/eigen3/cmake \
-DMINIGLOG=ON \
..
make
# Now you can find libceres.so inside libs folder