View device architecture
adb -s emulator-5554 shell getprop ro.product.cpu.abi
C:\Users\liyd>adb -s emulator-5554 shell getprop ro.product.cpu.abi
x86_64
C:\Users\liyd>adb -s 804c11f1 shell getprop ro.product.cpu.abi
arm64-v8a
mumu emulator 12
C:\Users\liyd>adb -s 127.0.0.1:7555 shell getprop ro.product.cpu.abi
x86_64
Architecture and CPU
Hardware matters when working with native code. The NDK provides you with a choice of ABIs, allowing you to ensure you compile for the correct architecture and CPU.
This section describes how to target a specific architecture and CPU at build time, how to use the ARM Neon extension instruction set, and how to use the CPU function library to query optional features at runtime.
Android ABI - NDK
bookmark_border
Different Android devices use different CPUs, and different CPUs support different instruction sets. Each combination of CPU and instruction set has its own Application Binary Interface (ABI). The ABI contains the following information:
Available CPU instruction sets (and extensions).
Endianness of memory stores and loads at runtime. Android is always little-endian.
Specifications for passing data between applications and the system, including alignment restrictions, and how the system uses the stack and registers when calling functions.
The format of executable binaries, such as programs and shared libraries, and the content types they support. Android always uses ELF. See ELF System V Application Binary Interface for details.
How to mang C++ names. See Generic/Itanium C++ ABI for details.
This page lists the ABIs supported by the NDK and describes how each ABI works.
ABI can also refer to the native APIs supported by the platform. For a list of such ABI issues affecting 32-bit systems, see 32-bit ABI bugs.
Supported ABIs
ZygoteInit.java
private static final String ABI_LIST_ARG = "--abi-list=";
private static final String SOCKET_NAME_ARG = "--socket-name=";
public static void main(String argv[]) {
566 try {
567 RuntimeInit.enableDdms();
568 // Start profiling the zygote initialization.
569 SamplingProfilerIntegration.start();
570
571 boolean startSystemServer = false;
572 String socketName = "zygote";
573 String abiList = null;
574 for (int i = 1; i < argv.length; i++) {
575 if ("start-system-server".equals(argv[i])) {
576 startSystemServer = true;
577 } else if (argv[i].startsWith(ABI_LIST_ARG)) {
578 abiList = argv[i].substring(ABI_LIST_ARG.length());
579 } else if (argv[i].startsWith(SOCKET_NAME_ARG)) {
580 socketName = argv[i].substring(SOCKET_NAME_ARG.length());
581 } else {
582 throw new RuntimeException("Unknown command line argument: " + argv[i]);
583 }
584 }
585
586 if (abiList == null) {
587 throw new RuntimeException("No ABI list supplied.");
588 }
589
590 registerZygoteSocket(socketName);
591 EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_START,
592 SystemClock.uptimeMillis());
593 preload();
594 EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END,
595 SystemClock.uptimeMillis());
596
597 // Finish profiling the zygote initialization.
598 SamplingProfilerIntegration.writeZygoteSnapshot();
599
600 // Do an initial gc to clean up after startup
601 gcAndFinalize();
602
603 // Disable tracing so that forked processes do not inherit stale tracing tags from
604 // Zygote.
605 Trace.setTracingEnabled(false);
606
607 if (startSystemServer) {
608 startSystemServer(abiList, socketName);
609 }
610
611 Log.i(TAG, "Accepting command socket connections");
612 runSelectLoop(abiList);
613
614 closeServerSocket();
615 } catch (MethodAndArgsCaller caller) {
616 caller.run();
617 } catch (RuntimeException ex) {
618 Log.e(TAG, "Zygote died with exception", ex);
619 closeServerSocket();
620 throw ex;
621 }
622 }