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.

95 lines
2.6 KiB

8 years ago
Building on Android
===================
### Note: *Build works ONLY on Linux systems. Current documentation shows how to build application on Ubuntu 18.04*
8 years ago
Pre-requisites
8 years ago
--------------
You need to install `rename` (required for building libraries), `OpenJDK` 11+, `gradle` 5.1+ and `Android SDK`.
8 years ago
```
sudo apt-get install g++ rename openjdk-11-jdk gradle
```
8 years ago
- Android [SDK](https://developer.android.com/studio#downloads) (choose command line tools only)
- If your system provides gradle with version < 5.1, download it from [Gradle](https://gradle.org/install/) homepage
8 years ago
Dependencies
------------
8 years ago
Prepare Android SDK and install required packages
8 years ago
```bash
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"
```
8 years ago
Clone repository with submodules
```bash
git clone --recurse-submodules https://github.com/PurpleI2P/i2pd-android.git
```
Compile required libraries
```bash
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
```
8 years ago
Building Android application
--------
8 years ago
### Build application
8 years ago
- Create `local.properties` file with path to SDK and NDK
3 years ago
```
sdk.dir=/opt/android-sdk
ndk.dir=/opt/android-sdk/ndk/21.4.7075529
```
3 years ago
- Run `gradle clean assembleDebug`
- You will find an .apk file in `app/build/outputs/apk` folder
8 years ago
### Creating release .apk
8 years ago
3 years ago
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](https://raw.githubusercontent.com/PurpleI2P/i2pd/9000b3df4edcbe7f2c8afd0e1e30609746311ace/contrib/certificates/router/orignal_at_mail.i2p.crt).
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:
3 years ago
```
export ANDROID_SDK_ROOT=/opt/android-sdk
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/21.4.7075529
```
3 years ago
- 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