Testing mobile sites on Android and its emulator (Mobilizing websites with responsive design and HTML5 part 11)

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.

Image

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.

Image

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.

 

\"\" Subscribe to RSS feed Image Follow me on Twitter Image Follow me on Facebook Image Follow me Google+

Android on-device debugging launch fails: Can’t bind to local 8600 for debugger

You try to launch Android app on the device from Eclipse. The debugger fails to connect and times out. Instead, you see this in the Console log:

Can't bind to local 8600 for debugger

To fix this do the following steps exactly in this order

  • Close Eclipse
  • Disconnect USB cable
  • Kill all adb instances on the task manager of your computer
  • Start Eclipse
  • Connect USB cable
  • Launch the application

If this does not help then make sure that you are using IPv4 address for localhost DNS loopback name. Edit /etc/hosts and comment out all IPv6 entries.

\"\" Subscribe to RSS feed Image Follow me on Twitter Image Follow me on Facebook Image Follow me Google+

Samsung Galaxy S i9000 and Android 2.1 – enable file copy over USB as mass storage mode on OSX and Linux

Samsung Galaxy S i9000 (Android 2.1) comes with Samsing Kies Windows software which is supposed to be used for copying files between your computer and the phone.

Naturally, this Windows software 1) is not very good 2) works on Windows only.

However, you can still mount  the device as normal USB mass storage. Just set Settings -> Applications -> Development -> Allow USB debugging checkbox on and replug the USB cable. Then open the notifications menu (pull down the top bar on the home screen). Now there is new option USB Connected. Choose it and then choose Mount.

You should be able to access both the phone internal storage and microSD memory card in Finder / Nautilus.

I created directory /media/mp3 where I copied few music files from my computer. I was able to achieve 5 MB/s transfer rate from my Asus Eee 1005HA PC when writing files to phone internal memory. The phone music player was able to pick up them fine.

More info

\"\" Subscribe to RSS feed Image Follow me on Twitter Image Follow me on Facebook Image Follow me Google+