i2pd documentation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.6 KiB

Building on Android

Note: Build works ONLY on Linux systems. Current documentation shows how to build application on Ubuntu 18.04

Pre-requisites

You need to install rename (required for building libraries), OpenJDK 11+, gradle 5.1+ and Android SDK.

sudo apt-get install g++ rename openjdk-11-jdk gradle
  • Android SDK (choose command line tools only)
  • If your system provides gradle with version < 5.1, download it from Gradle homepage

Dependencies

Prepare Android SDK and install required packages

mkdir /tmp/android-sdk
cd /tmp/android-sdk
wget <latest SDK link>
unzip commandlinetools-linux-*_latest.zip
# install required tools
./cmdline-tools/bin/sdkmanager --sdk_root=/opt/android-sdk "build-tools;31.0.0" "cmake;3.18.1" "ndk;21.4.7075529"

Clone repository with submodules

git clone --recurse-submodules https://github.com/PurpleI2P/i2pd-android.git

Compile required libraries

export ANDROID_SDK_ROOT=/opt/android-sdk
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/21.4.7075529

pushd app/jni
./build_boost.sh
./build_openssl.sh
./build_miniupnpc.sh
popd

Building Android application

Build application

  • Create local.properties file with path to SDK and NDK

    sdk.dir=/opt/android-sdk
    ndk.dir=/opt/android-sdk/ndk/21.4.7075529
    
  • Run gradle clean assembleDebug

  • You will find an .apk file in app/build/outputs/apk folder

Creating release .apk

In order to create release .apk you must obtain a Java keystore file(.jks). Either you have in already, or you can generate it yourself using keytool, or from one of you existing well-known certificates. For example, i2pd release are signed with this certificate.

Change file app\build.gradle by replacing pre-defined values with your own

release {
    storeFile file("i2pdapk.jks")
    storePassword "android"
    keyAlias "i2pdapk"
    keyPassword "android"
}

Run gradle clean assembleRelease

Building executable binary

  • Set environment variables:

    export ANDROID_SDK_ROOT=/opt/android-sdk
    export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/21.4.7075529
    
  • Run $ANDROID_NDK_HOME/ndk-build -j <threads> NDK_MODULE_PATH=$PWD from binary/jni folder

  • You will find an i2pd executable in binary/libs/<architecture> folder