Android

From PeerFreedom Wiki
Jump to navigation Jump to search
Build boost
  • Download android ndk
  • Download build script
  • Add permissions: chmod u+x <name of script>
  • Set ANDROID_NDK_ROOT env to ndk directory and run build script
Build libsodium
  • Download android ndk
  • Download libsodium
  • unset CXX
  • unset CC
  • export NDK_PLATFORM="android-22"
  • ./autogen.sh
  • ANDROID_NDK_HOME=<path to ndk>
  • ./dist-build/android-arm.sh
Build cpp app for android using cmake
  • finding libraries not works with this toolchain so you must set boost and libsodium library manually
  • cmake -DANDROID_PLATFORM=<android paltform> -DCMAKE_TOOLCHAIN_FILE=<path to ndk>/build/cmake/android.toolchain.cmake -DSODIUM_INCLUDE_DIR=<libsodium directory>/libsodium-android-armv6/include -DSODIUM_LIBRARY=<libsodium directory>/libsodium-android-armv6/lib/libsodium.a -DBoost_INCLUDE_DIR=<boost include directory> -DBoost_SYSTEM_LIBRARY_DEBUG=<boost libarary directory>/libboost_system.a -DBoost_FILESYSTEM_LIBRARY_DEBUG=<boost libarary directory>/libboost_filesystem.a -DBoost_THREAD_LIBRARY_DEBUG=<boost libarary directory>/libboost_thread.a .
  • make
  • send to android scp -P 2222 main root@192.168.1.110:~


Android version ANDROID_PLATFORM value[1]
2.3 android-9
2.3.3 android-10
3.0 android-11
3.1 android-12
3.2 android-13
4 android-14
4.0.3 android-15
4.1 android-16
4.2 android-17
4.3 android-18
4.4 android-19
4.4W android-20
5.0 android-21
5.1 android-22
6.0 android-23
7.0 android-24
7.1 android-25
8.0 android-26
8.1 android-27
9 android-28
Create APK for Android
  • SDK Platform release notes