Tùng Phan Thanh Tùng Phan Thanh - 22 days ago 9
Android Question

How to detect android device is 64 bit or 32 bit processor?

I'm trying to find a best solution for this question. The reason is the lib in our application can not run with the 64 bit processor so I need to turn it off in this case.
I found that in Android version 21 (lolipop)and higher we can easily detect that the device is 32 bit or 64 bit processor by using Build.SUPPORTED_64_BIT_ABIS and if It returns the String array with 0 elements then... a hah! The device is 32 bit processor.
How about lower android version? Build.SUPPORTED_64_BIT_ABIS just only support from android Lolipop version and higher.
Thanks & Best Regards,
Wish you guys all the best!

Answer

Simple answer: There's no need to check for this on Android versions below Lollipop. That's due the fact that Lollipop introducted platform support for 64-Bit architectures, Android-Versions below Lollipop won't run with a 64-Bit processor.

Android 5.0 introduces platform support for 64-bit architectures—used by the Nexus 9's NVIDIA Tegra K1. Optimizations provide larger address space and improved performance for certain compute workloads. Apps written in the Java language run as 64-bit apps automatically—no modifications are needed. If your app uses native code, we’ve extended the NDK to support new ABIs for ARM v8, and x86-64, and MIPS-64. (Source)