Skip to content

Commit

Permalink
[doc]update android doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google committed Feb 5, 2025
1 parent 92f71c4 commit 4104b69
Showing 1 changed file with 43 additions and 22 deletions.
65 changes: 43 additions & 22 deletions docs/platforms/android/android_building.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ There are following Apps on Android

<hr>

- [Building Android](#building-android)
- [Source files](#source-files)
- [Requirements for building](#requirements-for-building)
- [Linux](#linux)
- [MacOS](#macos)
- [ABIs and TARGET_CPU](#abis-and-target_cpu)
- [Gradle & JDK Version](#gradle--jdk-version)
- [Preparing for build](#preparing-for-build)
- [Building Android CHIPTool from scripts](#building-android-chiptool-from-scripts)
- [Building Android CHIPTool from Android Studio](#building-android-chiptool-from-android-studio)
- [Building Android CHIPTest from scripts](#building-android-chiptest-from-scripts)
- [Building Android](#building-android)
- [Source files](#source-files)
- [Requirements for building](#requirements-for-building)
- [Linux](#linux)
- [MacOS](#macos)
- [ABIs and TARGET\_CPU](#abis-and-target_cpu)
- [Gradle \& JDK Version](#gradle--jdk-version)
- [Kotlin Version](#kotlin-version)
- [Preparing for build](#preparing-for-build)
- [Building Android CHIPTool from scripts](#building-android-chiptool-from-scripts)
- [Building Android CHIPTool from Android Studio](#building-android-chiptool-from-android-studio)
- [Building Android CHIPTest from scripts](#building-android-chiptest-from-scripts)

<hr>

Expand All @@ -45,7 +46,7 @@ directory.
You need Android SDK 26 & NDK 23.2.8568313 downloaded to your machine. Set the
`$ANDROID_HOME` environment variable to where the SDK is downloaded and the
`$ANDROID_NDK_HOME` environment variable to point to where the NDK package is
downloaded. The build also requires `kotlinc` to be in your `$PATH`.
downloaded.

1. Install [Android Studio](https://developer.android.com/studio)
2. Install NDK:
Expand Down Expand Up @@ -97,24 +98,44 @@ architecture:

### Gradle & JDK Version

We are using Gradle 7.1.1 for all android project which does not support Java 17
(https://docs.gradle.org/current/userguide/compatibility.html) while the default
JDK version on MacOS for Apple Silicon is 'openjdk 17.0.1' or above.
All Android projects utilize Gradle version 7.3.3 and JDK version 17.0.

Using JDK bundled with Android Studio will help with that.
For developer using openjdk-17-jdk in MacOS, the JAVA_HOME environment variable
can be configured as follows via `sdkman`:

Android Studio Dolphin and below:
```
sdk install java 17.0.4.1-tem
```

```shell
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home/
For developer using openjdk-17-jdk in Linux, the JAVA_HOME environment variable
can be configured as follows:

```
sudo apt-get install openjdk-17-jdk
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
```

Android Studio Electric Eel 2022.1.1 and above:
<a name="kotlin"></a>

### Kotlin Version

The build requires `kotlinc` to be in your `$PATH`.

For Linux:

```shell
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home/
```
cd /usr/lib
wget -q https://github.com/JetBrains/kotlin/releases/download/v2.1.10/kotlin-compiler-2.1.10.zip
unzip kotlin-compiler-*.zip
rm kotlin-compiler-*.zip
rm -f kotlinc/bin/*.bat
export PATH=$PATH:/usr/lib/kotlinc/bin
```

For MacOS:
```
sdk install kotlin 2.1.10
```
<hr>

<a name="preparing"></a>
Expand Down

0 comments on commit 4104b69

Please sign in to comment.