Skip to content

Commit 0bb3ba3

Browse files
committed
Add native bridge support for ARM apps
1 parent f18e920 commit 0bb3ba3

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Access and control the Android emulator directly in your web browser with the in
5252
- **scrcpy Support:** Mirror the emulator screen using scrcpy for a seamless user experience.
5353
- **Optimized Performance:** Utilizes native CPU capabilities for efficient emulation.
5454
- **Multi-Architecture Support:** Runs natively on both **x86** and **arm64** CPU architectures.
55+
- **Native Bridge for ARM Apps:** Bundled libndk translation layer allows running ARM-only APKs on the x86 system image.
5556
- **Docker Integration:** Easily deploy the Android emulator within a Docker container.
5657
- **Easy Setup:** Simple Docker commands to build and run the emulator.
5758
- **Supervisor Management:** Manages emulator processes with Supervisor for reliability.

first-boot.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,31 @@ adb push gapps-11/framework /system
7070
adb push gapps-11/app /system
7171
adb push gapps-11/priv-app /system
7272

73+
# Install native bridge libraries for ARM compatibility
74+
echo "Installing native bridge ..."
75+
curl -L -o ndk-translation.tar.gz https://github.com/iwei20/libndk_extracted/archive/refs/heads/main.tar.gz
76+
mkdir ndk-translation
77+
tar -xf ndk-translation.tar.gz -C ndk-translation --strip-components=1
78+
for dir in bin etc lib lib64; do
79+
if [ -d ndk-translation/system/$dir ]; then
80+
adb push ndk-translation/system/$dir /system/
81+
fi
82+
done
83+
adb shell 'cat >> /system/build.prop <<"EOF"
84+
ro.dalvik.vm.native.bridge=libndk_translation.so
85+
ro.enable.native.bridge.exec=1
86+
ro.enable.native.bridge.exec64=1
87+
ro.vendor.enable.native.bridge.exec=1
88+
ro.vendor.enable.native.bridge.exec64=1
89+
ro.ndk_translation.version=0.2.3
90+
ro.dalvik.vm.isa.arm=x86
91+
ro.dalvik.vm.isa.arm64=x86_64
92+
ro.product.cpu.abilist=x86_64,x86,armeabi-v7a,armeabi,arm64-v8a
93+
ro.product.cpu.abilist32=x86,armeabi-v7a,armeabi
94+
ro.product.cpu.abilist64=x86_64,arm64-v8a
95+
EOF'
96+
rm -rf ndk-translation ndk-translation.tar.gz
97+
7398
echo "Root Script Starting..."
7499

75100
# Root the VM

start-emulator.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ if [ -f /data/.first-boot-done ]; then
66
fi
77

88
# Start the emulator with the appropriate ramdisk.img
9-
/opt/android-sdk/emulator/emulator -avd android -nojni -netfast -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics $RAMDISK -qemu -m ${RAM_SIZE:-4096}
9+
/opt/android-sdk/emulator/emulator -avd android -nojni -netfast -writable-system -no-window -no-audio -no-boot-anim -skip-adb-auth -gpu swiftshader_indirect -no-snapshot -no-metrics -feature AllowlistedNativeBridge $RAMDISK -qemu -m ${RAM_SIZE:-4096}

0 commit comments

Comments
 (0)