版本比较

密钥

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。
目录

a multi-core X86 host with a minimum requirement of 16GB of RAM and a minimum disk size of 512GB.

1. Install Ubuntu and Run the Container

  • Install docker

代码块
sudo apt install docker.io
  • Pull ubuntu:22.04 from the docker repository

代码块
sudo docker pull ubuntu:22.04
  • Run ubuntu:22.04

代码块
sudo docker run -it --name ubuntu_build_apk ubuntu:22.04

2. Install cmdline tools和ndk

  • Update the list of package

代码块
apt update
  • Go to the home directory and install the related tools

代码块
cd ~ && apt install wget zip openjdk-11-jre git openjdk-17-jre -y
  • Install cmdline package

代码块
wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip
  • Unzip the file

代码块
unzip commandlinetools-linux-10406996_latest.zip
  • Set PATEH environment variable

代码块
export PATH=$PATH:/root/cmdline-tools/bin/
  • Set ANDROID_SDK_ROOT environment variable

代码块
mkdir /root/sdk_root && export ANDROID_SDK_ROOT=/root/sdk_root/
  • Install android ndk21.1.6352462

代码块
sdkmanager --sdk_root=/root/sdk_root/ 'ndk;21.1.6352462'

If you encounter the prompt "Accept?(y/N):" during the command execution, please press 'y'.

3. Build Systemui APK

  • Get the source code and go to the boringdroidsystemui directory

代码块
git clone https://gitee.com/openfde/boringdroidsystemui && cd boringdroidsystemui
  • Set JAVA_HOME environment variable

代码块
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
  • Execute gradle and build the apk

代码块
./gradlew build

Helpful tip: During the process of building an APK using this command, the Gradle installation package will be downloaded first. If the build process is taking a long time, you can follow the four steps below to speed up this step.

Step 1: Execute the command ./gradlew build, which will generate a directory. In the example given below, it is /root/.gradle/wrapper/dists/gradle-7.6-bin/9l9tetv7ltxvx3i8an4pb86ye/. Please locate the folder generated in your own gradle-7.6-bin directory.

...

Step 2: Manually download the Gradle installation package.
9l9tetv7ltxvx3i8an4pb86ye with your own directory name.

代码块
wget https://services.gradle.org/distributions/gradle-7.6-bin.zip

...

Step 3: Copy the Gradle archive to the generated directory. Make sure to replace 9l9tetv7ltxvx3i8an4pb86ye with your own directory name.

代码块
cp gradle-7.6-bin.zip /root/.gradle/wrapper/dists/gradle-7.6-bin/9l9tetv7ltxvx3i8an4pb86ye/

Step 4: Execute the build process again. This time, the build process will be much faster!

代码块
./gradlew build

Note: Due to the requirement of sdkmanager to run on Java 17 and the limitation of compiling APKs on Java 11, it is necessary to reset JAVA_HOME to Java 11. Compiling with Java 17 will result in the following error.

Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens http://java.io " to unnamed module @71cff6a8.

After compilation is complete, you can find the BoringdroidSystemUI.apk file in the app/build/outputs/apk/release directory.

4. Build FdeVNC APK

  • Back to the home directory and get the source code of fde-vnc

代码块
cd ~ && git clone https://gitee.com/openfde/remote-desktop-clients 
  • Go tot the remote-desktop-clients directory and build bVNC-app

代码块
cd remote-desktop-clients && ./gradlew :bVNC-app:assembleRelease  -PVersionName="1.0.5"

5. Compile gallery_fde

  • Back to the home directory and get the source code of gallery-fde

代码块
cd ~ && git clone https://gitee.com/openfde/gallery_fde
  • Go to the gallery-fde and change its mode

代码块
cd gallery_fde && chmod +x gradlew
  • Build app

代码块
./gradlew  build -PappVersion=1.0.6

6. Copy APK to AOSP

Open a new Linux shell terminal and copy the compiled APK files from sections 3.3 and 3.4 out of the container.

代码块
docker cp ubuntu_build_apk:/root/boringdroidsystemui/app/build/outputs/apk/release/BoringdroidSystemUI.apk  $AOSP_TOP_DIR/vendor/prebuilts/bdapps/bin/BoringdroidSystemUI.apk
代码块
docker cp ubuntu_build_apk:/root/remote-desktop-clients/bVNC-app/build/outputs/apk/release/FdeVncClient.apk $AOSP_TOP_DIR/device/openfde/fde/fde_vnc/

$AOSP_TOP_DIR represents the top-level directory of the AOSP source tree.