在项目中引入so库时,有时候需要知道android设备的CPU架构信息,,可通过以下方式知晓当前设备的CPU架构信息.
ADB命令查看Android的CPU型号架构等信息
进入shell命令后(adb shell) 执行 cat /proc/cpuinfo
执行结果
JAVA代码获取CPU架构信息
/**
* The name of the instruction set (CPU type + ABI convention) of native code.
* @deprecated Use {@link #SUPPORTED_ABIS} instead.
*/
String cpuInfo = android.os.Build.CPU_ABI;
注释告诉我们,该属性已被废弃使用,建议使用SUPPORTED_ABIS代替
/**
* An ordered list of ABIs supported by this device. The most preferred ABI is the first
* element in the list.
*
* See {@link #SUPPORTED_32_BIT_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}.
*/
public static final String[] SUPPORTED_ABIS = getStringList("ro.product.cpu.abilist", ",");