diff --git a/nearby/README.md b/nearby/README.md index 3801bfe841..845188245b 100644 --- a/nearby/README.md +++ b/nearby/README.md @@ -40,9 +40,9 @@ Then, add the jar in IDE as below. 1. Menu: File > Project Structure 2. Select Modules at the left panel and select the Dependencies tab. 3. Select the + icon and select 1 JARs or Directories option. -4. Select the JAR file found above. +4. Select the JAR file found above, make sure it is checked in the beginning square. 5. Click the OK button. -6. Restart the IDE to index. +6. Restart the IDE to re-index. ## Build and Install @@ -54,3 +54,23 @@ $ $ANDROID_BUILD_TOP/out/host/linux-x86/bin/deapexer decompress --input \ --output /tmp/tethering.apex $ adb install -r /tmp/tethering.apex ``` + +## Build and Install from tm-mainline-prod branch +When build and flash the APEX from tm-mainline-prod, you may see the error below. +``` +[INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade of APEX package com.google.android.tethering is not allowed. Active version: 990090000 attempted: 339990000]) +``` +This is because the device is flashed with AOSP built from master or other branches, which has +prebuilt APEX with higher version. We can use root access to replace the prebuilt APEX with the APEX +built from tm-mainline-prod as below. +1. adb root && adb remount; adb shell mount -orw,remount /system/apex +2. cp tethering.next.apex com.google.android.tethering.apex +3. adb push com.google.android.tethering.apex /system/apex/ +4. adb reboot +After the steps above, the APEX can be reinstalled with adb install -r. +(More APEX background can be found in https://source.android.com/docs/core/ota/apex#using-an-apex.) + +## Build APEX to support multiple platforms +If you need to flash the APEX to different devices, Pixel 6, Pixel 7, or even devices from OEM, you +can share the APEX by ```source build/envsetup.sh && lunch aosp_arm64-userdebug```. This can avoid + re-compiling for different targets.