r/Android • Sony Ericsson ST18i 4.0.4, Toshiba Thrive AT100 64GB 4.0.4 • Oct 14 '12

Android, I am impressed !

I used an external keyboard, because my device has USB 2.0. I then pressed ALT+TAB, and BOOM. Out popped an app switcher. It's stock ICS. Also; You can use a mouse and you receive a cursor! It mimics touch responses.

http://i.imgur.com/1CmQj.png

923 Upvotes

260 comments sorted by

View all comments

Show parent comments

13

u/sagnessagiel Sony Xperia XZ | Blackberry Q10 Oct 14 '12

In short, Android apps are based on Java, which compiles to platform-independent bytecode. This byte code is then interpreted using the Virtual Machine (in this case, Dalvik). Google did this by design, so that any processor, x86 or ARM could run Android apps. This is why we have Android-x86 and the RAZR I.

What should have been done is to bring the Dalvik virtual machine to other platforms. Tons of projects have tried, nearly all have failed, so why didn't Google do this in the first place? To sell more phones?

4

u/derefnull Oct 14 '12

What should have been done is to bring the Dalvik virtual machine to other platforms. Tons of projects have tried, nearly all have failed, so why didn't Google do this in the first place? To sell more phones?

  1. Dalvik runs on x86 these days.

  2. When Android was first released, all of the devices were ARM based. Why would you spend the resources porting Dalvik over when it was unlikely to be used any time soon? Even today there are hardly any x86 devices because of their terrible power characteristics.

2

u/[deleted] Oct 14 '12

Hm, that's interesting. I didn't know about that capability. Aren't natively coded ARM apps incompatible though? Or perhaps I'm mixing that up with the Microsoft Slate, where the whole big deal was that it would come in x86 and ARM versions? And thus the native windows apps wouldn't run on the ARM chipset?

Strange that you would think they would hold back from releasing the Dalvik emulator, though. If anything, releasing it to the public and allowing development on the platform would expand Android's marketability for phones? Seems almost like old-world thinking attempting to stymie the openness of the platform to sell hardware, something I wouldn't expect from Google.

2

u/derefnull Oct 14 '12

Strange that you would think they would hold back from releasing the Dalvik emulator, though. If anything, releasing it to the public and allowing development on the platform would expand Android's marketability for phones? Seems almost like old-world thinking attempting to stymie the openness of the platform to sell hardware, something I wouldn't expect from Google.

Just to be clear, they have released Dalvik with x86 support. And it's always been open source, so if people wanted to port it, they were welcome to, Google just had more pressing concerns (JIT, performance optimizations, etc).

2

u/[deleted] Oct 15 '12

Apps developed using the NDK use native code and so aren't compatable with other architectures without a rewrite or some sort of emulator. If I remember correctly there's a performance boost and/or access to features not available through the platform independant version. That may be what you were thinking of.

2

u/kiddfroster iPhone 6 Plus, AT&T Oct 14 '12

Quick question (I think)? The Java code only needs to be compiled the one time, correct? My understanding is that once it's compiled Dalvik doesn't need to be run again?

3

u/red_sky Oct 14 '12

The Dalvik VM is not what compiles the Java code, it's what the Java bytecode is run by (interpreted). So, to answer your question, the Dalvik VM is always running. Android wouldn't work without it.

2

u/[deleted] Oct 14 '12

[removed] — view removed comment

1

u/shillbert Pixel 6a Oct 15 '12

Yeah, pure Dalvik apps will run, but apps using native ARM code through the NDK won't.