As part of the Android 11 developer preview, Google has released Android 11 OS images, which are capable of executing ARM binaries, with significant performance improvements. Previously, developers who relied on ARM libraries to build x86 variant applications either had to use a system image with full ARM emulation, which is much slower than an x86 system image running on an X86-based computer, or resort to physical devices. The new Android 11 system image can translate ARM instructions into x86 instructions without affecting the entire system. This allows the execution of ARM binaries for testing without the performance overhead of full ARM emulation.
details
The meaning of this may require some context, especially if you build your application using only Kotlin or the Java programming language. Unlike Kotlin or Java programming languages, which both execute on Android Runtime (ART), any C++ in an Android application is compiled directly into machine instructions. This means that you need to compile differently depending on the architecture of the target device. Mobile phones tend to have ARM processors; Therefore, many C++ dependent libraries that you might add to your application, such as the camera barcode scanner library, are compatible only with ARM processors. This can be a problem if you’re developing on a computer based on an x86 processor, as it can prevent you from running applications.
Previously, if you wanted to get around this limitation and execute an application built for ARM on an x86 machine, you had to use an emulator system image that fully emulates ARM. Emulated system images with full ARM emulation tend to run much slower than x86-based system images when running on x86 hosts because of the overhead of converting the entire system-valued ARM instructions to x86. In addition, emulated system images with full ARM emulation cannot take advantage of the hardware acceleration and CPU virtualization technologies provided by x86 processors.
The new ARM-compatible Android 11 system image can run x86 system images natively using virtualization technology as usual. When an application’s process needs an ARM binary, the binary is exclusively translated to x86 in that process. This allows the rest of the process to continue executing in x86, including Android Runtime (ART) and other performance-critical libraries such as libGLES and libvulkan. In addition, the converter avoids expensive memory access instrumentation and the associated performance impact because it avoids executing low-level hardware-specific libraries. These new simulator system images can be used locally or on your own continuous integration infrastructure. This is possible thanks to a partnership with ARM LTD.
Looking to the future
If you previously opted for a physical device due to a lack of ARM support, try Android 11 System images, which are now available with the Android 11 Developer Preview. These system images can be downloaded in Android Studio through the SDK Manager or Android Virtual Device Manager.
Once you’ve got your app running on the emulator, consider adapting it for Chrome OS. It also supports running Android applications developed for ARM on x86 laptops. Building Chrome OS provides a substantial ecosystem of big-screen devices, enabling your apps to reach more people around the world.
This technology will enable more developers to test using the Android emulator. Still, Google recommends that developers release both x86 and ARM ABI variants of their applications to maximize physical device performance and reach as many users as possible. Going forward, Google plans to roll out the technology to a wider variety of API levels and ensure that it supports all use cases that will be used to test physical devices. Since this is a new technology, please report any questions via Google’s official question tracker.
Note that the ARM to x86 translation technology enables the implementation of intellectual property owned by ARM LTD. It is only available on the Google API and Play Store system images, and can only be used for application development and debugging on x86 desktops, laptops, customer local servers, and customer purchased cloud-based environments. This technique should not be used to provide commercial hosting services.
By Michael HazardAndroid-developers.googleblog.com/2020/03/run…199 yuan Study Package:Click to receive
Original address:Androidweekly. IO/news – androi…
Copyright notice: All forms of reprint – no commercial – no derivative
The public no. :Android Development Technology Weekly