Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

The title is pretty much self-explanatory: is Android a 32- or 64- bit OS? I assume that it is one or another and not both, as that would force both 32- and 64-bit binaries to be hosted on Google Play. I know that this is a simple question, and that other people have been asking it, but for the life of me I have not been able to find an answer on the web, and there is certainly not one on this SE.

share|improve this question
add comment

3 Answers 3

up vote 31 down vote accepted
+500

In the realm of the ARM chipsets which is the common factor, the entire Android stack, from the near-identical kernel based on Linux, are in fact, 32bit, cross-compiled from usually either a 32bit/64bit host environment, the host environment is usually one of the distributions of Linux. Recommended distribution, by Google, for building and cross-compiling Android is Ubuntu.

The Android run-time library (media, graphics, filesystem, to name but a few) are also 32bit, but as we reach the layer of the dalvikvm, then the number of bits becomes irrelevant as it is at this point, the apks coming from the Google Play Store are native bytecode (A "by-product" of generated Java code compiled into a portable bytecode) which targets the DalvikVM (Virtual Machine) which in turn interprets and translates the bytecode targetting the raw ARM instruction set.

Froyo was the last Android that enabled compilation under a 32bit hosted environment in which it was cross-compiled targetting the ARM chipset.

Gingerbread was the first of "future" Android, back then circa, three years ago, that introduced a requirement to use a 64bit hosted environment in which it was built. There was many hacks to get Gingerbread to be built under 32bit hosted environment.

ICS and JB, and upwards now definitely requires a 64bit environment to speed up compilation and to reduce turn-around time in building.

So to sum up, what you see on the Play Store has no bearing on whether 32bit or 64bit are used and thus irrelevant.

Side note: Typical 16GB RAM/Quad core/64bit Linux distribution, the time it takes to build ICS from scratch, takes 30minutes maximum, had this being a 32bit Linux distribution, it would have taken longer, in fact, may cause a CPU meltdown as there is simply, not enough processing power to churn and crank out cross-compiled code, which is a very demanding and taxing process!

Proof of this.

Pull in any native ARM binary found in /system/bin or /system/xbin, for example, /system/bin/dalvikvm, this is the Dalvik VM binary that is responsible for the upper layers of Java and APKs.

Now, examine the binary by issuing this command: file dalvikvm which gives a summary of the type of file it is, the expected output would be this:

dalvikvm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped

Notice the reference to 32-bit ELF, and is cross-compiled to ARM and is a binary executable.

Right, moving on, let's inspect a native shared library found in /system/lib, for example, /system/lib/libandroid_runtime.so, now issue file libandroid_runtime.so, the expected output would be this:

libandroid_runtime.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, stripped

Again, notice, its 32-bit ELF, cross-compiled to ARM and is a shared library.

The key to the host's cross-compilation can be found in the AOSP source, i.e., Gingerbread build originally had a requirement to be built on a 64bit host system, here's the newsgroup linky referring to how to patch the scripts to get it to build on 32bit host which has two patches, found here, for build/core.mk and build/main.mk (combined) on AOSP's Gerrit review.

As a subsequent result, this patch had made its way to ICS's build scripts in which I did have the privilege of compiling ICS on a 32bit platform which took 3 days to build (it was a port of ICS for the Zte Blade). Now, the requirements are ramped up, you do definitely need 64bit host to enable cross-compilation of building AOSP from ICS upwards :)

share|improve this answer
2  
Interesting stuff, but it would be nice to have some sources in the answer. –  Peanut Jan 4 '13 at 9:42
    
Why the downvote? Care to provide a reason in spirit of ASE? –  t0mm13b Jan 7 '13 at 16:20
    
-1 some sources would have being nice. –  Coder101 Mar 23 '13 at 19:59
    
+1, because even if there are no sources, at least half the leg-work for the research was done to help find what to look for. Don't -1 the guy for doing a decent attempt at helping and answering the question... –  haylem May 18 '13 at 22:53
add comment

All ARM chips are currently 32-bit. Because of this, Android currently executes all code in a 32-bit environment.

64-bit processors set to launch in 2014.

share|improve this answer
1  
That's not exactly a reliable source as this was talking about servers, to quote “Smartphone is a little bit further off,” Forsyth said., we're talking about ARM in the context of Android/Smartphones/Tablets. –  t0mm13b Jan 4 '13 at 16:49
add comment

Is Android a 32- or 64- bit OS? I assume that it is one or another and not both, as that would force both 32- and 64-bit binaries to be hosted on Google Play.

Neither actually. Android is a Dalvik VM-based OS, and Google Play hosts Dalvik applications. Dalvik VM itself, like Java VM, is always 32-bit regardless of the bitness of the physical machine.

As you suspected, applications that ships with native binaries and NDK applications must ship with binaries compiled for every architectures it is intended to run at. The most common architecture that Android runs on is ARM 32-bit; however there are also devices that runs on x86 and MIPS.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.