.:::. Run Android Apps on Your Windows PC .:::.
A Few Words About Android Apps
You'll want to keep in mind a few things about Android apps. Unlike the heavily policed iPhone App Store, the Android OS version, the Android Market, has much looser guidelines. In fact, some consider the Android Market to be the wild west of apps: Almost anything goes, and malicious apps are often pulled from the Android Market only after users complain. As to how widespread the potential is for malware in the Android Market, the mobile phone software security company, SMobile Systems, recently released a report that estimates that "one in every five applications request permissions to access private or sensitive information that an attacker could use for malicious purposes." It's unlikely that every single one of these apps is requesting this information intentionally for the purpose of sending it back to cybercrooks. In all probability, the majority of these apps are either using this information for legitimate purposes (such as Internet banking) or are just the by-product of developers' sloppy coding. But at least some of these apps may be trying to steal your information and put it in the hands of individuals you probably would rather not have it.
And the Android Market isn't even the only source for downloading and installing Android apps. A number of independent Android apps stores have already been doing business for a while now (such as Softonic, Handango, and GetJar), and new ones are starting to pop up (such as AndSpot, SlideMe, and AndAppStore) now that the popularity of Android phones is increasing. How these independent sources will mind the cybergates still remains to be seen.
You are going to run into a challenge, however, once you start trying to install apps on your virtual Android device. By default, any virtual Android device created by the Android SDK doesn't include the Android Market—the Android OS images created by the SDK are a pretty bare-bones affair. So you might very well be limited to installing only those apps that are available from the independent Android apps stores. For instance, the version of Lookout Mobile Security FREE that I installed was downloaded from GetJar. That said, I was able to get the Android Market successfully working on a virtual Android device.
I show you how to create and use a virtual Android device on a Windows PC, as well as how to download and install Android apps from the independent Android apps stores. This is all done with the latest iteration of the Android OS: 2.2, which is also known as Froyo (Froyo is shorthand for "frozen yogurt"—all of the Android OS codenames are named after desserts). And I finish up this primer with what you need to know to set up an Android 1.6 virtual device with a working Android Market.
Installing the Android SDK
All of the examples I provide here were done on a system running Windows 7; but they should be just as applicable for virtually any system running 32-bit Windows XP or 32- or 64-bit Windows Vista. There are even versions of the Android SDK that run on Intel-based Macs loaded with Mac OS X 10.5.8 and later and some versions of Linux, but the steps to getting this to work on these other operating systems differ somewhat from you'll find in this guide.
The first thing you need to do is to make sure that Java is installed on your system. If you're not sure,check out the official Java Website —it will tell you if Java is installed and if so, which version. If you don't have Java installed or it's an older version, follow the onscreen instructions for installing the latest version. The documentation for the Android SDK suggests that you install the JDK (Java Development Kit) version of Java; but unless you are a developer all you really need is the standard version of Java, which is officially called the Java SE Runtime Environment—if you are downloading it using Internet Explorer, it might be listed as "Java for Windows Internet Explorer."
Once you confirm that Java is properly installed, the next step is to download the Android SDK Starter Package—you'll be downloading a zip file. When you unzip it you should have a folder called android-sdk-windows. You can put this folder anywhere you want on your computer—everything runs out of this folder and there is no software to install in the traditional sense. Just remember where you put the folder, because no shortcuts or desktop icons get created unless you do so manually.
Navigate to the android-sdk-windows folder and launch SDK Setup.exe, which is the Android SDK and AVD Manager application.
If Java is not properly installed, an error message will pop up stating that Java cannot be found.
If this is the first time you've run the Android SDK and AVD Manager, you might see a Refresh Sources window that says the repository can't be found. If you do, you'll have to change the SDK's settings to use HTTP, instead of the default HTTPS. To do this, click Close. Next you'll see a "Choose Packages to Install" window, but with nothing listed. Click Cancel. The next window you should see is the Android SDK and AVD Manager window. Select the Settings tab and in the Misc section enable the "Force https://... Sources to be fetched using http://..." setting.
Now select the Available Packages tab. You should see a single site in the list: https://dl-ssl.google.com/android/repository/repository.xml. Select this site and a list of packages should appear below it. If you want to play around with the different versions of the Android OS then enable all the packages.
If you only want to use Android 2.2, then the only packages you'll need to download are "Documentation for Android SDK, API8, revision 1"; "SDK Platform Android 2.2, API8, revision 1"; "Samples for SDK API8, revision 1"; and Google APIs by Google Inc., Android API8, revision 1."
Once you've selected the packages you want to download, click the "Install Selected" button. This opens the "Choose Packages to Install" window, with all of the previously selected packages listed. (If you didn't encounter the HTTPS error when you first launched the SDK then this is the first screen you should see.) Don't hit the Install button quite yet. You'll notice that some of the listed packages have question marks next to them. This means that you have to accept the license agreement for each of these packages before you can install them. Select each package that has a question mark next it and click the Accept button. Once all the packages have check marks next to them go ahead and click the Install button.
If you chose to install all of the available packages, it may take a few minutes to download them all. When it is done, you'll see a window that says something like "Done, 12 packages installed." Click Close.
Creating an Android Virtual Device
Now you're finally ready to create you very first virtual Android device! The Android SDK actually refers to this as an Android Virtual Device or AVD—which is what I will be calling it from here on out. Select the Virtual Devices tab and click on the New button.
This opens a Create new Android Virtual Device (AVD) window. There's actually not much to creating an AVD. All you really need to do are:
Name: Give the AVD a name. Pretty much any name will do that uses alphanumeric characters.
Target: Here is where you pick the version of the Android OS that the AVD will be based on. For this example, choose Android 2.2.
SD Card Size: This is where you choose the size of the AVD's virtual SD card. The SD Card size must be at least 9MB. For this example, create a 1GB SD Card.
Skin: You can choose any pre-defined (built-in) or custom resolution that you want—it doesn't have to match the resolution or aspect ratio of a real phone screen. For this scenario, chosse WVGA800 (800x480), which is the screen resolution of a number of phones, such as the HTC Incredible. If you wanted to, you could set a custom resolution that simulated what an Android tablet might look like—perhaps with a screen resolution of 1024x600.
Hardware: These items will be selected automatically. You don't need to make any additions or changes here—unless you are a developer and you know what you are doing.
Now click the Create AVD button.
The AVD will be created lickety-split, and a window will pop up stating that the AVD has been created. Click OK to close the window. Note that once you create an AVD, its settings can't be changed. If want to make any changes, you'll need to create a brand new AVD. The AVD you just created should now appear in the list of Virtual Devices.
To launch the AVD, select it and then click the Start button. A Launch Options window opens, which allows you to Scale the display and Wipe user data. You might be tempted to choose the Scale display option--but don't, because if you do, the resulting window will be the physical size of a phone screen (about only three inches tall). Don't select the Wipe user data option either (though we will be using this option later when we set up the Android 1.6 AVD that includes the Android Market). Just click the Launch button to start the AVD.
It might take a couple of minutes for the AVD to launch; so be patient. But soon enough, the AVD will appear on your screen. The AVD is also referred to as an emulator because it "emulates" an Android device.
You'll see a window on the left that is the device's display, and a window on the right that houses the device's navigation buttons and virtual keyboard. In most cases you seldom have to use the onscreen navigation buttons or keyboard—your system's real mouse and keyboard should do the trick.
Here are some useful mappings to help you navigate in the AVD using your system's keyboard:
Before you start exploring, one of the first things you might want to do is confirm that the AVD has Internet access. Look in the status bar (running across the top of the AVD's display screen) and determine if you see an icon that has four bars with the first two bars lit up. If so, then the AVD at least thinks it has Internet access. You can confirm that the AVD's Internet access works by clicking on the Web browser icon in the bottom panel of the home screen—this is the icon that looks like a globe—and seeing if it connects to the Internet.
Home Go to the Home Screen
F2 Menu Button
ESC Back Button
F6 Toggle Trackball Mode
Ctrl+F5 Increase Volume
Ctrl+F6 Decrease Volume
Ctrl+F11 Switch Between Portrait and Landscape Mode
Alt+Enter Toggle Full-Screen Mode
The AVD is simply piggybacking off of your system's Internet connection. While experimenting with the Android SDK on a number of different systems, I encountered a few situations where an AVD's Internet connection did not work. In all of these instances, the system was connected to the Internet via an Ethernet cable; but the system also had a Wi-Fi radio that wasn't connected to an access point. Connecting the system's Wi-Fi radio to an access point and restarting the AVD resolved the Internet access issue for me.
If you click the Launcher icon (the icon that is made up of 4x4 squares), you'll see the apps that come preinstalled in the AVD. You're likely going to be disappointed—there aren't many apps here at all. But fret not; in the next section I explain how to install Android apps onto your AVD.
But before we discuss installing apps, a few words on quitting and starting an AVD. Quitting an AVD is as simple as just closing the window. Really. That's all there is to it.
As to starting an existing AVD, there are a number of different ways to this. One is to launch the Android SDK and AVD Manager (SDK Setup.exe) application, and then start the AVD from the Virtual Devices tab. But if you're going to be using the same AVD on a regular basis, here's how you can create a shortcut for it, so you can launch the AVD directly from your desktop:
1. Determine the exact name of the AVD you want the shortcut to launch. You can get this info either from the Android SDK and AVD Manager or from the physical location where the AVDs are saved, which is C:\Users\[username]\.android\avd\
2. Create a new desktop shortcut for the emulator.exe file that resides in the ...\android-sdk-windows/tools folder.
3. Once you've created the shortcut, edit its properties and add these options to the end of the target text field: -avd [name-of-avd]. This isn't case-sensitive, so you can do it all in lowercase. For my example, the shortcut's full target text field reads as follows: c:\android-sdk-windows\tools\emulator.exe –avd extremetech-froyo
Now whenever you want to launch the AVD, all you have to do is double-click the shortcut.
Installing Apps From Independent Android Apps Stores
If you've followed these instructions up to this point, you've got an AVD running Android 2.2, with a few barely useful apps and no Android Market. So how are you going to get apps onto your AVD? By downloading them from one of the independent Android apps stores.
Using your computer's Web browser, navigate to one of the Android apps stores, such as Softonic, Handango, or GetJar). Find the apps you want to download and click the respective download buttons for those apps.
Android apps exist in files that have the APK (Android Package) file extension. An APK file is actually a package that contains a number of bundled components—similar to how a zip file works. In fact, when you download an Android app file, it might have either an APK or ZIP file extension. If you download an Android app that has a ZIP extension, don't try to unzip it—just change the ZIP extension to APK.
So how do you install an Android app that you've downloaded onto your computer's hard drive? The first thing you need to do is fire up the AVD and wait for it to launch. Once the AVD is running, make sure that it's set to permit the installation of non-Market applications. Do this by selecting the Launcher icon, choose the Settings icon, click on Applications, and make sure that Unknown sources is enabled.
With the AVD running, open a Windows Command-Prompt window (or what we old-schoolers like to call a DOS-Prompt window). You'll be typing a command that executes the adb.exe application that lives in the android-sdk-windows/tools folder, followed by a space, then the word install, another space, and then the Android app's file name. The trick is, you also need to include the full paths for both the adb.exe app and the APK file you are installing (unless they both live in the same folder).
Here's an example of how I installed the Word Search app in my AVD:
c:\android-sdk-windows\tools\adb.exe install c:\temp\wordsearch.apk
It might take a few moments to install. When the word "Success" appears in the Command Prompt window, you know it has installed. I've found that on rare occasions, installation will fail on the first try, but succeed on a second attempt.
Now if you go back to the AVD, you should see an icon for the app you just installed appear amongst the other apps. Launch the app and it should run as expected.
If you want to uninstall an app, do so by going to Settings > Applications > Manage Applications > Downloaded, then select the application you want to delete, and click the Uninstall button.
If the AVD actually had access to the Android Market, then there would be a bevy of Uninstall applications to choose from—which would make uninstalling apps a much easier task. I didn't have much luck finding a working uninstall app from the independent Android apps stores.
Accessing the Android Market in an AVD
1. Create an AVD that uses Android 1.6—but don't start it yet.
2. Download the system.img file available here.
3. Copy the system.img file you just downloaded to the AVD folder for the AVD you just created. You can find this folder in ...\.android\avd in your user folder. For example, I created an AVD called "Market" and this is the path to its folder on my system: C:\Users\ExtremeTech\.android\avd\Market.avd
4. Start the AVD for the first time; but when the Launch Options window opens, enable the Wipe user data option. Then click the Launch button. You should only have to do this once—on subsequent launches of the AVD, disable the Wipe user data option.
5. Once the AVD loads, you'll have to go through a few setup screens; but you can skip most of them.
6. Navigate over to the Applications page and you should see an icon for the Android Market, as well as a few other apps that weren't present in the Android 2.2 AVD—such as Google Maps and Google Talk.
7. Before you can access the Android Market you'll have to either create a Google account or enter the login credentials for an existing Google account.
8. Once your Google account credentials are entered, you can access the Android Market and start downloading apps into the AVD!
Have fun exploring Android and the rapidly growing world of Android apps!