Category Archives: Android

Debugging IO on Android

Android is Linux based, so there are some interesting way to monitor and debug IO activity especially on storage.

The one I found more useful is this:

  1. enable dumping of IO info
    echo 1 > /proc/sys/vm/block_dump
  2. observe kernel log
    cat /proc/kmsg
  3. make your analysis
  4. disable dumping of IO info
    echo 0 > /proc/sys/vm/block_dump

The output you will get is similar to this:
<7>[71477.927886] kswapd0(24): WRITE block 21240712 on mmcblk0p12 (8 sectors)
<7>[71477.928436] kswapd0(24): WRITE block 21410792 on mmcblk0p12 (8 sectors)
<7>[71477.928710] kswapd0(24): WRITE block 21240704 on mmcblk0p12 (8 sectors)
<7>[71477.929016] kswapd0(24): WRITE block 21240656 on mmcblk0p12 (8 sectors)
<7>[71477.929443] kswapd0(24): WRITE block 25427968 on mmcblk0p12 (8 sectors)
<7>[71477.929687] kswapd0(24): WRITE block 8 on mmcblk0p12 (8 sectors)
<7>[71477.930084] kswapd0(24): WRITE block 0 on mmcblk0p12 (8 sectors)
<7>[71478.086639] sdcard(159): READ block 23431168 on mmcblk0p12 (256 sectors)
<7>[71478.087036] sdcard(159): READ block 23430912 on mmcblk0p12 (8 sectors)
<7>[71478.258148] sdcard(159): READ block 23430920 on mmcblk0p12 (200 sectors)
<7>[71478.258514] sdcard(159): READ block 23431424 on mmcblk0p12 (8 sectors)
<7>[71478.266967] sdcard(138): READ block 23430656 on mmcblk0p12 (32 sectors)
<7>[71478.268798] sdcard(159): READ block 23430688 on mmcblk0p12 (64 sectors)
<7>[71478.269409] sdcard(159): READ block 23430752 on mmcblk0p12 (128 sectors)
<7>[71478.271484] sdcard(159): READ block 23430880 on mmcblk0p12 (32 sectors)
<7>[71478.600646] sdcard(138): READ block 23431432 on mmcblk0p12 (512 sectors)
<7>[71478.765136] sdcard(159): READ block 23431944 on mmcblk0p12 (256 sectors)
<7>[71478.958129] Compiler(412): READ block 327320 on mmcblk0p11 (8 sectors)
<7>[71478.958557] Compiler(412): READ block 327400 on mmcblk0p11 (48 sectors)

Tried on my rooted Galaxy Nexus with CyanogenMod 10.1.0-RC1.

 

Android on Ubuntu: IOException on aapt

As I told in a previous post, I’m setting up a new Ubuntu installation and I want to compile something for Android on it.

After installing Android SDK I got this error on my first iteration of “ant debug”

BUILD FAILED
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:621: The following error occurred while executing this line:
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:657: Execute failed: java.io.IOException: Cannot run program "/home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt": error=2, No such file or directory

The error is in some way misleading because the binary is there, but the problem is that it’s a 32-bit executable

max@praxi:~$ ls -l /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt
-rwxr-xr-x 1 max max 929400 Jul 27 14:33 /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt

max@praxi:~$ file /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt
/home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped

The solution is near: we need 32-bit libraries

root@praxi:~# aptitude install ia32-libs

As always it’s a good idea to RTFM:

The Android Ant-based build system requires Ant 1.8.0

I’m setting up a new Ubuntu installation (Quantal Quetzal) and I’m going to play with some Android code on it.

The first test I did after installing the Android SDK gave me this result:

BUILD FAILED
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:377: The Android Ant-based build system requires Ant 1.8.0 or later. Current version is 1.7.1

This is not what I needed, but fortunately the solution is easy enough.
Doing something like this solved my issue:

root@praxi:~# aptitude install ant=1.8.2-4build2

Done