As part of my app I\'m using the NDK and was wondering if it\'s worth bundling x86 and mips binaries alongside the standard ARM binaries.
I figured the best way woul
Try this command:
adb shell getprop ro.product.cpu.abi
It tells whether cpu is ARM or Intel , 64 or 86_64
You can use adb command
adb shell getprop ro.product.cpu.abi adb shell getprop ro.product.cpu.abi2
and refer the [site]: How to know a process of an app is 32-bit or 64-bit programmatically in Android lollipop?
If you're looking for the Lollipop API
import android.os.Build;
Log.i(TAG, "CPU_ABI : " + Build.CPU_ABI);
Log.i(TAG, "CPU_ABI2 : " + Build.CPU_ABI2);
Log.i(TAG, "OS.ARCH : " + System.getProperty("os.arch"));
Log.i(TAG, "SUPPORTED_ABIS : " + Arrays.toString(Build.SUPPORTED_ABIS));
Log.i(TAG, "SUPPORTED_32_BIT_ABIS : " + Arrays.toString(Build.SUPPORTED_32_BIT_ABIS));
Log.i(TAG, "SUPPORTED_64_BIT_ABIS : " + Arrays.toString(Build.SUPPORTED_64_BIT_ABIS));
You can use the Build class:
import android.os.Build;
and then read:
Build.CPU_ABI
The values you are looking for are
ro.product.cpu.abi
and
ro.product.cpu.abi2
These can be got using internal api SystemProperties.get So you will have to use Reflection on SystemProperties.
You could use the function getSystemProperty if you are not too keen on reflection. Check it here
My Code looks like this
private String cpuinfo()
{
String arch = System.getProperty("os.arch");
String arc = arch.substring(0, 3).toUpperCase();
String rarc="";
if (arc.equals("ARM")) {
rarc= "This is ARM";
}else if (arc.equals("MIP")){
rarc= "This is MIPS";
}else if (arc.equals("X86")){
rarc= "This is X86";
}
return rarc;
}
You can also use android SDK, take a look on the Build
class:
/** The name of the instruction set (CPU type + ABI convention) of native code. */
public static final String CPU_ABI = getString("ro.product.cpu.abi");
/** The name of the second instruction set (CPU type + ABI convention) of native code. */
public static final String CPU_ABI2 = getString("ro.product.cpu.abi2");