HTML5 Zone is brought to you in partnership with:

A friendly Finnish hacker. I am technology consultant, open source advocator and entrepreneur. My expertise areas cover HTML5, Python, Plone, Javascript, WebGL,UNIX and mobile web. Mikko likes sushi, Angry Birds and dislikes winter. Mikko is a DZone MVB and is not an employee of DZone and has posted 43 posts at DZone. You can read more from them at their website. View Full User Profile

Testing mobile sites on Android and its emulator

01.07.2013
| 5561 views |
  • submit to reddit

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.

Android Browser’s WebKit based rendering engines is a moving target and support for HTML5 and CSS3 vary greatly between Android releases. For example, HTML5 <video> support is known to be broken to the point you cannot really use it. It also does other funny stuff. JIT Javascripting support was introduced in Android 2.3.

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.

4. Screenshots

Taking screenshots on the Android device itself is pain – special debugger commands are needed. Samsung has made its own screenshot shortcut for Android devices.

Published at DZone with permission of Mikko Ohtamaa, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)