This blog post is a part of Mobilizing websites with responsive design and HTML5 tutorial. For all posts please see the Introduction post.
This blog post deals testing mobile sites for Android devices. Android comes with a browser called Android Browser (very Germanic naming habits they have…). It is developed separate from Google Chrome which saw its first mobile release recently. Android also features many after market browsers which will be dealt separately in an upcoming blog post.
Because there are no forced firmware updates and carries and OEMs are being more evil than Google, Android version market share is very fragmented. Currently the most popular Android versions are 2.2 and 2.3. Android 4.0 (Ice Cream Sandwitch) is generally under on 1% depending on the markets.
Luckily, unlike with IE, Android mobile devices broke down quite fast and we don’t need to bear with old buggy browser releases for unforeseeable future, only for the next few years.
1. Android Emulator
Android SDK and emulator run on all Microsoft Windows, Linux and OSX, the SDK being most versatile of all mobile vendor SDKs. Android SDK is free – no registration needed.
Download Android SDK
Note: Android emulator is an actual emulator, not simulator. It emulates the full device, including executing ARM processor code on your CPU. It is 1:1 emulation. However, the price for this accuracy is that the emulation speed is sluggish as a brown bear waking up on Finnish winter morning. Testing sites on the emulator is painful – testing on the actual device with proper logging support (see below) is recommended.
Note: There is x86 Android port coming up and if someone has more information if x86 emulators already exist and if you could run Android Browser on then I’d like to know. Running native processor code should greatly speed up the emulation experience.
For Android SDK, get the Eclipse IDE plug-in. It features nice logging options and quick start for different emulator versions.
Android emulator allows you to experience with different screen sizes and DPI ratios.
2. Android Devices
Android devices are cheap and for testing you should easily get low end Android smartphone under 150 USD. SIM card is not necessary, you can test mobile sites over WLAN connection.
The device speed is an also an issue – many Android devices are equipped withß underpowered CPU and GPU. When you test for Android, get the cheapest possible device (ZTE) to make sure you’ll get the crappiest user experience out of it – this is what the most of Android users will get. Don’t get expensive phone like Samsung Galaxy or Nexus.
3. Logging and debug console output
Android emulators and devices have a logging capability called LogCat. console.log() output is directed to LogCat log stream.
- You can view LogCat logs on the device itself using a free app (e.g. aLogCat, donationware)
- You can view both emulator and simulator log output using command line LogCat tools on your computer
- You can view both emulator and simulator log output in Eclipse LogCat view
- You can view the device logs over USB connection in Eclipse LogCat view (maybe with some issues when connecting to device)
- Depending on your OS, you might need to install a device specific special drivers to make your OS to communicate over Android USB debug protocol
- Android USB debug must be enabled in the device settings. This menu item also enables mounting Android device as USB disk and file copy operations.
Taking screenshots on the Android device itself is pain – special debugger commands are needed. Samsung has made its own screenshot shortcut for Android devices.