使用System.getProperty(“ os.arch”)检查它是否是armeabi cpu [英] Using System.getProperty("os.arch") to check if it is armeabi cpu

查看:623
本文介绍了使用System.getProperty(“ os.arch”)检查它是否是armeabi cpu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一些旧的4.2.2-设备(银河s3 mini,银河ace 3,银河新鲜等)上,RenderScript存在以下问题- Android-Renderscript支持库-加载RS jni库时出错

I'm having the following issue with RenderScript on some old 4.2.2- devices (galaxy s3 mini, galaxy ace 3, galaxy fresh, etc.) - Android - Renderscript Support Library - Error loading RS jni library.

我想实施建议的解决方案,但是

I want to implement the suggested solution but what exactly will be the value returned by


System.getProperty( os.arch );

System.getProperty("os.arch");

用于 armeabi 设备(不是armeabi-v7设备)。

for armeabi devices (not armeabi-v7 devices).

谢谢。

推荐答案

方法 System.getProperty 是Java的通用方法,此处,您可以找到该文档。

The method System.getProperty is a generic method of Java, here you can find the documentation.

在Linux上,它返回从命令 uname -m 获得的相同值。可能的值例如是 armv5t armv5te armv5tej armv5tejl armv6 armv7 armv7l i686 等。 armeabi 设备没有确切的值,因为它在cpu之间略有不同。

On Linux it returns the same value obtained from the command uname -m. The possible values are for example armv5t, armv5te, armv5tej, armv5tejl, armv6, armv7, armv7l, i686 and many more. There isn't an exact value for the armeabi devices because it slightly differs from cpu to cpu.

System.getProperty 的更好替代方法,它是字段 Build.CPU_ABI (或 Build .SUPPORTED_ABIS (在较新的设备中):

There is a better alternative to System.getProperty and it is the field Build.CPU_ABI (or Build.SUPPORTED_ABIS in newer devices):

String abi = null;

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    abi = Build.CPU_ABI;
} else {
    abi = Build.SUPPORTED_ABIS[0];
}

可能的值为 armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64

The possible values are armeabi, armeabi-v7a, arm64-v8a, x86, x86_64, mips, mips64.

您可以看到,可能结果的数量比 System.getProperty 低得多,您可以直接检查为 armeabi

As you can see the number of possible results is much lower than System.getProperty, and you can check directly for armeabi.

这篇关于使用System.getProperty(“ os.arch”)检查它是否是armeabi cpu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆