Android Studio如何得知JNI使用的是哪个ABI或者是toolchain呢 新手刚用Android Studio,建立了一个包含C++代码的小项目,我想了解一下有没有设置可以获知当前Gradle和cmake编译的C++代码使用的是什么API或者使用的是armabi-v7a还是x86的呢?先谢谢大家了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是获取当前手机的ARM处理器类型 /** * * [获取cpu类型和架构] * * @return * 三个参数类型的数组,第一个参数标识是不是ARM架构,第二个参数标识是V6还是V7架构,第三个参数标识是不是neon指令集 */ public static Object[] getCpuArchitecture() { if ((Integer) mArmArchitecture[1] != -1) { return mArmArchitecture; } try { InputStream is = new FileInputStream("/proc/cpuinfo"); InputStreamReader ir = new InputStreamReader(is); BufferedReader br = new BufferedReader(ir); try { String nameProcessor = "Processor"; String nameFeatures = "Features"; String nameModel = "model name"; String nameCpuFamily = "cpu family"; while (true) { String line = br.readLine(); String[] pair = null; if (line == null) { break; } pair = line.split(":"); if (pair.length != 2) continue; String key = pair[0].trim(); String val = pair[1].trim(); if (key.compareTo(nameProcessor) == 0) { String n = ""; for (int i = val.indexOf("ARMv") + 4; i < val.length(); i++) { String temp = val.charAt(i) + ""; if (temp.matches("\\d")) { n += temp; } else { break; } } mArmArchitecture[0] = "ARM"; mArmArchitecture[1] = Integer.parseInt(n); continue; } if (key.compareToIgnoreCase(nameFeatures) == 0) { if (val.contains("neon")) { mArmArchitecture[2] = "neon"; } continue; } if (key.compareToIgnoreCase(nameModel) == 0) { if (val.contains("Intel")) { mArmArchitecture[0] = "INTEL"; mArmArchitecture[2] = "atom"; } continue; } if (key.compareToIgnoreCase(nameCpuFamily) == 0) { mArmArchitecture[1] = Integer.parseInt(val); continue; } } } finally { br.close(); ir.close(); is.close(); } } catch (Exception e) { e.printStackTrace(); } return mArmArchitecture; } 求android自定义控件如何添加点击事件,长按事件 SQLlite删除操作问题 怎样用ftpclient在service下载 关于删除RadioButton的文字 求URLEncoder和URLDecoder详解 关于dialog的问题 安装apk包出错 模范google io做了一个控件 ListView Android Studio出现“Cannot resolve symbol XXXX”问题应该如何解决? android studio 没有design界面 gridlayout中如何合理布置多个android统计图或者webview
/**
*
* [获取cpu类型和架构]
*
* @return
* 三个参数类型的数组,第一个参数标识是不是ARM架构,第二个参数标识是V6还是V7架构,第三个参数标识是不是neon指令集
*/
public static Object[] getCpuArchitecture() {
if ((Integer) mArmArchitecture[1] != -1) {
return mArmArchitecture;
}
try {
InputStream is = new FileInputStream("/proc/cpuinfo");
InputStreamReader ir = new InputStreamReader(is);
BufferedReader br = new BufferedReader(ir);
try {
String nameProcessor = "Processor";
String nameFeatures = "Features";
String nameModel = "model name";
String nameCpuFamily = "cpu family";
while (true) {
String line = br.readLine();
String[] pair = null;
if (line == null) {
break;
}
pair = line.split(":");
if (pair.length != 2)
continue;
String key = pair[0].trim();
String val = pair[1].trim();
if (key.compareTo(nameProcessor) == 0) {
String n = "";
for (int i = val.indexOf("ARMv") + 4; i < val.length(); i++) {
String temp = val.charAt(i) + "";
if (temp.matches("\\d")) {
n += temp;
} else {
break;
}
}
mArmArchitecture[0] = "ARM";
mArmArchitecture[1] = Integer.parseInt(n);
continue;
}
if (key.compareToIgnoreCase(nameFeatures) == 0) {
if (val.contains("neon")) {
mArmArchitecture[2] = "neon";
}
continue;
}
if (key.compareToIgnoreCase(nameModel) == 0) {
if (val.contains("Intel")) {
mArmArchitecture[0] = "INTEL";
mArmArchitecture[2] = "atom";
}
continue;
}
if (key.compareToIgnoreCase(nameCpuFamily) == 0) {
mArmArchitecture[1] = Integer.parseInt(val);
continue;
}
}
} finally {
br.close();
ir.close();
is.close();
}
} catch (Exception e) {
e.printStackTrace();
}
return mArmArchitecture;
}