Get Architecture Plainly Without Version In Android


Read {count} times since 2020

If you want to just get plainly the architecture of system like “arm” or “x86” in your apps, then this post is just for you.

So with this function that I’m gonna present, you will get 3 values, “arm”, “mips” or “x86” whether or not the system is 32 bit or 64 bit.

Here is the function :

public static String getArch() {
  String arch = System.getProperty("os.arch").substring(0, 3).toLowerCase();
  if (arch.equals("aar") || arch.equals("arm")) {
    return "arm";
  }else if(arch.equals("mip")){
    return "mips";
  }else{
    return arch;
  }
}

Just call it statically if it’s under a class :

MyClass.getArch()

and you can correctly check if it’s an ARM or MIPS or x86 :

if(getArch().equals("arm"))
  // Hurray, it's an ARM system