Hussein Kasem 2f715f9f88
Android build: Move from 3.7.3 patch to 3.7.3 release
2021-06-07 15:50:58 +02:00
external Android build: Move from 3.7.3 patch to 3.7.3 release 2021-06-07 15:50:58 +02:00
jni JNI-106 Android build: update to use current Makefile and api. 2020-08-26 12:35:50 +02:00
res/arm64-v8a Add address sanitizer patch. 2019-05-24 19:45:31 +02:00
src/foundation/pEp/jniadapter Android build: Update engine version on 2021-05-13 21:27:36 +02:00
AndroidManifest.xml Switch to sequoia and update from pEp.* to foundation.* 2019-05-24 19:39:07 +02:00 Add build instructionds for Android 2020-05-01 10:41:20 +02:00
build.gradle Android build: Apply nettle 3.7.3 patch 2021-06-07 15:08:29 +02:00
enable_address_sanitizer.patch Add address sanitizer patch. 2019-05-24 19:45:31 +02:00

Build pEpJNIAdapter for Android

** Asuming machine is already set up to build pEp Engine and Sequoia! **

Install dependencies

sudo port -N install gsed wget autoconf automake libtool md5sha1sum openjdk8

## optionaly (not needed if using Android Studio)
sudo port -N install gradle

Install NDK

It can be done with the SDK and the sdkmanager cli tool, or using Android Studio.

Android studio -> Configure -> SDK Manager -> SDK Tools (tab) -> Select NDK and install

Tip: To install other versions click on "Show packages details" and select the desired NDK version (Currently using: 21.0.6113669)

Required env_vars (for MacOS):

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export ANDROID_NDK=$ANDROID_SDK/ndk/21.0.6113669
export HOST_TAG=darwin-x86_64
export ANDROID_MIN_SDK_32=18
export ANDROID_MIN_SDK_64=21
export NDK_TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/$HOST_TAG


Add Rust android targets

rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

Tell rust the location of the new target linker and AR

echo "
ar = \"$NDK_TOOLCHAIN/bin/aarch64-linux-android-ar\"
linker = \"$NDK_TOOLCHAIN/bin/aarch64-linux-android$ANDROID_MIN_SDK_64-clang\"

ar = \"$NDK_TOOLCHAIN/bin/arm-linux-androideabi-ar\"
linker = \"$NDK_TOOLCHAIN/bin/armv7a-linux-androideabi$ANDROID_MIN_SDK_32-clang\"

ar = \"$NDK_TOOLCHAIN/bin/x86_64-linux-android-ar\"
linker = \"$NDK_TOOLCHAIN/bin/x86_64-linux-android$ANDROID_MIN_SDK_64-clang\"

ar = \"$NDK_TOOLCHAIN/bin/i686-linux-android-ar\"
linker = \"$NDK_TOOLCHAIN/bin/i686-linux-android$ANDROID_MIN_SDK_32-clang\"
" >> $HOME/.cargo/config

Build it

Open the android project with Android Studio, this will generate the file with the sdk location.

To build can be done form the Gradle menu (on the right in android studio) and select the build task, or just calling gradle build form terminal.

gradle build #Run inside JNIAdapter/android