3.3 KiB
Building Session
Basics
Session uses Gradle to build the project and to maintain
dependencies. However, you needn't install it yourself; the
"gradle wrapper" gradlew
, mentioned below, will do that for you.
Dependencies
You will need Java 8 set up on your machine.
Ensure that the following packages are installed from the Android SDK manager:
- Android SDK Build Tools (see buildToolsVersion in build.gradle)
- SDK Platform (All API levels)
- Android Support Repository
- Google Repository
In Android studio, this can be done from the Quickstart panel, choose "Configure" then "SDK Manager". In the SDK Tools tab of the SDK Manager, make sure that the "Android Support Repository" is installed, and that the latest "Android SDK build-tools" are installed. Click "OK" to return to the Quickstart panel. You may also need to install API version 28 in the SDK platforms tab.
You will then need to clone and run ./gradlew install
on each of the following repositories IN ORDER:
- https://github.com/loki-project/loki-messenger-android-curve-25519
- https://github.com/loki-project/loki-messenger-android-protocol
- https://github.com/loki-project/loki-messenger-android-meta
- https://github.com/loki-project/session-android-service
This installs these dependencies into a local Maven repository which the main Session Android repository will then draw from.
Setting up a development environment and building from Android Studio
Android Studio is the recommended development environment.
- Open Android Studio. On a new installation, the Quickstart panel will appear. If you have open projects, close them using "File > Close Project" to see the Quickstart panel.
- From the Quickstart panel, choose "Checkout from Version Control" then "git".
- Paste the URL for the session-android project when prompted (https://github.com/loki-project/session-android.git).
- Android Studio should detect the presence of a project file and ask you whether to open it. Click "yes".
- Default config options should be good enough.
- Right now, the google-services.json file is kept out of the public repository as it contains credentials for Firebase (used for push notifications) authentication. We haven't yet made a way to build the app without this file or without Firebase. Email niels@loki.network to get this file for your build.
- Project initialisation and building should proceed.
Building Session from the command line
The following steps should help you (re)build Session from the command line once all dependencies have been acquired.
-
Checkout the session-android project source with the command:
git clone https://github.com/loki-project/session-android.git
-
Make sure you have the Android SDK installed.
-
Create a local.properties file at the root of your source checkout and add an sdk.dir entry to it. For example:
sdk.dir=/Application/android-sdk-macosx
-
Execute Gradle:
./gradlew build
Contributing code
Code contributions should be sent via github as pull requests, from feature branches as explained here.