Android os.arch output for ARM, MIPS, x86?

后端 未结 3 1570
我寻月下人不归
我寻月下人不归 2020-12-30 05:27

In order to identify the platform of an Android device, it seems that the java system property \"os.arch\" will suffice:

Log.i(\"mytag\", \"os.arch: \" + Sys         


        
相关标签:
3条回答
  • 2020-12-30 05:54

    This may be help

    1. Build.CPU_ABI The name of the instruction set (CPU type + ABI convention) of native code.
    2. Build.CPU_ABI2 The name of the second instruction set (CPU type + ABI convention) of native code.

    More Info Android Build Class

    0 讨论(0)
  • 2020-12-30 05:59

    These values come from a Linux structure. They can be displayed from a shell by cat /proc/cpuinfo. The ARM defines them in the arch/arm/mm directory. From this directory,

    grep cpu_arch_name * | grep string | cut -d \, -f2 | sort | uniq
    
    • armv4
    • armv4t
    • armv5t
    • armv5te
    • armv5tej
    • armv6
    • armv7

    The arm7l indicates "little endian" mode, but this is selectable and depends on the kernel. I would think most ARM kernels will be "little endian", unless it is a network centric product (like an Android router). This is the same as uname -m. On the x86, it returns "i686" on a PowerPC, it returns "ppc". I don't have a MIPS system, but my guess is "mips", but it could be the assortment found in cpu-probe.c

    There are over 20 architectures in Linux all with different CPU versions. The answer is far less for current Android ports. However, it is possible that any of them can be used in the future. I think that the ARM is the only one sending a sub-architechure.

    See also: uname() man page, Wikipedia's Uname, Server faults's uname machines, OpenJdk mailing list

    0 讨论(0)
  • 2020-12-30 06:05

    According to what I can find in the Android source tree the ro.product.cpu.abi property (which you can access as CPU_ABI through the Build class) should have the following architecture-to-value mapping:

    32-bit ABIs:

    ARM: "armeabi-v7a" (or possibly "armeabi" if it's a really old / low-end device)

    x86: "x86"

    MIPS: "mips"


    64-bit ABIs:

    ARM: "arm64-v8a"

    x86: "x86_64"

    MIPS: "mips64"

    0 讨论(0)
提交回复
热议问题