The Open Source part of Android (AOSP) provides an ARM and x86 emulator based on QEMU. When you install Android SDK (via Android Studio or not), you can download a bunch of system images for the emulator. The google’s images allow you to run ARM APKs inside an x86_64 images. The technology is called Native Bridge/NDK translation.
I do not know how this works (yet), but i wanted to share with you how you can build your own emulator images with this proprietary technology.
Warning: This might not be legal, I’m just providing a Proof of Concept, for educational purpose.
The first thing to do is to boot up a Google emulator image, I have used this one:
Pkg.Desc=System Image x86 with Google APIs.
Pkg.Revision=9
Pkg.Dependencies=emulator#30.0.4
AndroidVersion.ApiLevel=30
SystemImage.Abi=x86
SystemImage.TagId=google_apis
SystemImage.TagDisplay=Google APIs
SystemImage.GpuSupport=true
Addon.VendorId=google
Addon.VendorDisplay=Google Inc.
NDK translation uses the ‘binfmt_misc’ Linux capability to execute ARM binaries inside an x86 emulator. It supports ARM Android executable as well as shared object (APKs).
For ARM32 & ARM 64 support you need to pull:
bin/arm/
bin/arm64/
etc/binfmt_misc/arm_*
etc/binfmt_misc/arm64_*
etc/init/ndk_translation.rc
etc/init/ndk_translation_arm64.rc
etc/ld.config.arm.txt
etc/ld.config.arm64.txt
lib/arm/
lib/libndk_translation*.so
lib64/arm64/
lib64/libndk_translation*.so
Once you have all the files added to your tree, you then need to install them on the target and configure and enable the native bridge as shown below:
#
# ARM and ARM64 on x86_64 native bridge
# Based on proprietary binaries found in the system images of the Android SDK
#
PRODUCT_PROPERTY_OVERRIDES += \
ro.dalvik.vm.isa.arm=x86 \
ro.dalvik.vm.isa.arm64=x86_64 \
ro.enable.native.bridge.exec=1 \
ro.dalvik.vm.native.bridge=libndk_translation.so
PRODUCT_COPY_FILES += \
$(call find-copy-subdir-files,*,$(LOCAL_PATH)/google-ndk-translation,$(TARGET_COPY_OUT_SYSTEM))
Et voilà! You can now install ARM and ARM64 APK in the emulator.
Will eventually follows up…
This post was written (quickly) for sharing with the android-x86 google group and the new AndroidEmu discord channel.
Leave a reply to Adam Cancel reply