mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-22 19:01:30 +00:00
readme: Update and add detailed steps to build instructions (#1865)
Currently, the build instructions are very brief and don't explain the whole process of setting up the build environment in detail. Thus, add explicit steps on how to download required tools and prepare then for compilation. Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
This commit is contained in:
parent
67ea05a5cd
commit
b8896f8f1c
1 changed files with 53 additions and 11 deletions
64
README.md
64
README.md
|
@ -19,20 +19,62 @@ Language mappings are defined in `.tx/config`, with the second code being the on
|
|||
|
||||
# Building
|
||||
|
||||
### Dependencies
|
||||
- Android SDK, with `$ANDROID_HOME` pointing to it (you can skip this if you are using Android Studio)
|
||||
- Android NDK (you should install the required version (`ext.ndkVersionShared` in `./build.gradle`) with the usual tools, such that it's located within `$ANDROID_HOME/ndk/`).
|
||||
- Go (see [here](https://docs.syncthing.net/dev/building.html#prerequisites) for the required version)
|
||||
- Java Version 11 (you scan skip this if you are using Android Studio, otherwise you might need to set `$JAVA_HOME` accordingly)
|
||||
These dependencies and instructions are necessary for building from the command
|
||||
line. If you build using Docker or Android Studio, you don't need to set up and
|
||||
follow them separately.
|
||||
|
||||
### Build instructions
|
||||
## Dependencies
|
||||
|
||||
Make sure you clone the project with
|
||||
`git clone https://github.com/syncthing/syncthing-android.git --recursive`. Alternatively, run
|
||||
`git submodule init && git submodule update` in the project folder.
|
||||
1. Android SDK and NDK
|
||||
1. Download SDK command line tools from https://developer.android.com/studio#command-line-tools-only.
|
||||
2. Unpack the downloaded archive to an empty folder. This path is going
|
||||
to become your `ANDROID_HOME` folder.
|
||||
3. Inside the unpacked `cmdline-tools` folder, create yet another folder
|
||||
called `latest`, then move everything else inside it, so that the final
|
||||
folder hierarchy looks as follows.
|
||||
```
|
||||
cmdline-tools/latest/bin
|
||||
cmdline-tools/latest/lib
|
||||
cmdline-tools/latest/source.properties
|
||||
cmdline-tools/latest/NOTICE.txt
|
||||
```
|
||||
4. Navigate inside `cmdline-tools/latest/bin`, then execute
|
||||
```
|
||||
./sdkmanager "platform-tools" "build-tools;<version>" "platforms;android-<version>" "extras;android;m2repository" "ndk;<version>"
|
||||
```
|
||||
The required tools and NDK will be downloaded automatically.
|
||||
|
||||
Build Syncthing using `./gradlew buildNative`. Then use `./gradlew assembleDebug` or
|
||||
Android Studio to build the apk.
|
||||
**NOTE:** You should check [Dockerfile](docker/Dockerfile) for the
|
||||
specific version numbers to insert in the command above.
|
||||
2. Go (see https://docs.syncthing.net/dev/building#prerequisites for the
|
||||
required version)
|
||||
3. Java version 11 (if not present in ``$PATH``, you might need to set
|
||||
``$JAVA_HOME`` accordingly)
|
||||
4. Python version 3
|
||||
|
||||
## Build instructions
|
||||
|
||||
1. Clone the project with
|
||||
```
|
||||
git clone https://github.com/syncthing/syncthing-android.git --recursive
|
||||
```
|
||||
Alternatively, if already present on the disk, run
|
||||
```
|
||||
git submodule init && git submodule update
|
||||
```
|
||||
in the project folder.
|
||||
2. Make sure that the `ANDROID_HOME` environment variable is set to the path
|
||||
containing the Android SDK (see [Dependecies](#dependencies)).
|
||||
3. Navigate inside `syncthing-android`, then build the APK file with
|
||||
```
|
||||
./gradlew buildNative
|
||||
./gradlew assembleDebug
|
||||
```
|
||||
4. Once completed, `app-debug.apk` will be present inside `app/build/outputs/apk/debug`.
|
||||
|
||||
**NOTE:** On Windows, you must use the Command Prompt (and not PowerShell) to
|
||||
compile. When doing so, in the commands replace all forward slashes `/` with
|
||||
backslashes `\`.
|
||||
|
||||
# License
|
||||
|
||||
|
|
Loading…
Reference in a new issue