Cupcake vs Donut vs Eclair vs FroYo

The version of Android running on your emulator (or real phone) must be compatible with your program's build target. For example, if you try to run an Android 2.2 (FroYo) program on an Android 1.5 (Cupcake) phone, it won't work because Android 1.5 phones can only run 1.5 or earlier programs. Android 2.2 phones, on the other hand, can run programs built for 2.2, 2.1, 2.0.1,2.0,1.6,1.5, and earlier. But it may be a while before most phones have been upgraded (if ever).

So, why not just target Android 1.5? Unfortunately, applications built for 1.5 don't always display correctly on the larger and smaller screens found on 1.6 phones. Luckily, there's an easy way to make your programs compatible with all versions of Android. See Chapter 13, Write Once, Test Everywhere, on page 256 for instructions.

Figure 1.5: Running the "Hello, Android" program
Figure 1.6: Creating an AVD In Eclipse

Starting the emulator is expensive. Think about it this way— when you first turn on your phone, it needs to boot up just like any computer system. Closing the emulator is just like turning off the phone or pulling the batteries out. So, don't turn it off!

Leave the emulator window running as long as Eclipse is running. The next time you start an Android program, Eclipse will notice the emulator is already there and will just send it the new program to run.

0 0

Post a comment