Android Developer FAQs

From Texas Instruments Wiki
Jump to: navigation, search

Content is no longer maintained and is being kept for reference only!

This is wiki guide covering android developer FAQs. The goal of this guide is to cover all commonly faced problems while porting android on custom hardware.

Note: Answers suggested here might not be "The Solution" - As it depends on other environment variables. Also some of the answers and conclusion has been taken from online (group/forum) discussions.



Q: While booting, kernel boots fine but problem comes when actual Android processes start.Following logs appears on the screen.

"init: process 'servicemanager', pid 879 exited"

Ans: There could be various reasons.But most frequent problem is - android log driver is disable inside kernel.Kindly try to set loglevel 8 in init.rc and reboot.If same message appears then 99% problem is the same as described. Kindly enable log driver and try.

    -> Device Drivers             
      -> Staging drivers (STAGING [=y])
         -> Exclude Staging drivers from being built (STAGING_EXCLUDE_BUILD [=n])
           -> Android
             -> Android Drivers (ANDROID [=y])

Android System

Q: init.rc tutorial. Android initialization process


Q: How to port an Android on ARM based SoC?


Q: Where to add custom property in Android?

Ans: Kindly refer "dalvik/vm/Properties.c" file.

Property can be added inside function "dvmCreateDefaultProperties" @dalvik/vm/Properties.c file.
e.g. setProperty(propObj, put, <prop_name>, <prop_value>);

Q: What is android property architecture ?

Ans: : Very good explain given by rxwen at

Q: How to create custom service in Android ?

Ans: : Wiki guide & few references are mentioned below

Q:logcat is not working. Command "ls /sys/kernel/logger" return error. What is the catch?

Ans: Quick note: logcat is driven by “/dev/log/*” fs entries., (probably /sys/kernel/logger is obsolete now)

Try launching a valid console service with root permission

service console /system/bin/sh
    user root
    group log

Also, cross check permissions for /dev/log?

#cd /dev/log
#ls  -l l*
drwxr-xr-x root     root              2000-01-02 20:08 log
#cd log
#ls –l *
# ls -l
crw-rw--w- root     log       10,  52 2000-01-02 20:08 system
crw-rw--w- root     log       10,  53 2000-01-02 20:08 radio
crw-rw--w- root     log       10,  54 2000-01-02 20:08 events
crw-rw--w- root     log       10,  55 2000-01-02 20:08 main

One can check what are being set in /ueventd.rc
# logger should be world writable (for logging) but not readable
/dev/log/*                0662   root       log

Q:How to write a script, which can run after android boot?

Below scenario explains how usb drive can be auto mount using script.

In your init.rc add:
+mkdir /usbmountd

+service usbmountd /system/bin/usbmountd
+    disabled

+on device-added-/dev/sda1
+    start usbmountd

Create/edit /system/bin/usbmountd script as:

case "$1" in
        mount -t vfat /dev/block/sda1 /usbmountd
        umount /dev/block/sda1
        echo "$0: unknown argument $1." >&2;

Once the device is mounted you can browse through the files from any of the available Android file manager applications because your device won't be mounted as External Storage and won't be auto scanned for media files.

Q: How to set http-proxy proxy sqlite3 in android ?

Ans: :

Q: How does touchscreen or keyboard event process in android ? Input event handling in android

Ans: :

Q: How to see apk contents ?

Ans: : jar -tvf <apk-name>.apk

Q: How to change android start language ?

Ans: : Kindly refer the link #

Q: How to access (read and write) linux tty serial port using Android API ?

Ans: : Refer to the project # android-serialport-api


Q:How to do auto mount sdcard ?

Ans: : One need to modify entry in /etc/vold.fstab.

dev_mount sdcard <mount location> <partition number> <mmc entry><br>

e.g. For data created at partition#3, one need to put following entry in /etc/vold.fstab<br>
dev_mount sdcard /mnt/sdcard 3 /devices/platform/mmci-omap-hs.0/mmc_host/mmc0

Q:Where to locate memory footprint of android ?


Q:Where to locate prelink android libraries ?

Ans: : Refer "build/core/" file

Q: How to use generic audio ?

Ans: : Sometime we face default AudioFlinger service can't start correctly and enters a loop showing the following messages:

I/ServiceManager(  866): Waiting for sevice media.audio_policy...
I/ServiceManager(  866): Waiting for sevice media.audio_policy...
W/AudioSystem(  866): AudioPolicyService not published, waiting...

Instead of rebuilding the full Android root file system, this problem can be quickly fixed with the following procedure: 1) edit the frameworks/base/services/audioflinger/ file adding on top:


2) rebuild AudioFlinger with the following commands:

#source build/
#mmm -B frameworks/base/libs/audioflinger

This will need some dependencies to be satisfacted. The fastest way is by copying the libraries from the prebuilt root file system into the out/target/product/generic/system/lib/ and out/target/product/generic/obj/lib/ directories.

3) Once compiled, simply copy the file out/target/product/generic/obj/lib/ on the prebuilt root file system, overwriting the previous version

Debug & Log

Q: How to debug android crash?

Ans: : There are various technique available @ at times when system/service/application or any other crash, it would be easy if we can get line number from crash address.

#arm-none-linux-gnueabi-addr2line -f -e <.so path> <address>
#arm-none-linux-gnueabi-addr2line -f -e ~/rowboat-android/out/target/product/beagleboard/system/lib/ 0x000043a8
/* will give line number of last accessed address @ crashed point */ 

Other references for debugging:


TI porting guide available at

Q: How to port wifi driver to Android device?

Ans: : Kindly refer 'Porting WiFi drivers to Android'

  4. Most common mistake while porting wifi device :

Q: How to configure keypad on Android device?

Ans: : Kindly refer link#

Q: How to get GPIO Keypad working ?

Ans: : The GPIO keypad driver example is at
Please use this to implement a keypad driver, Check the events on Android console ( using command #getevent). Once one start getting the events then one should modify the .kl file in Android (device/ti/<yourboard>/<keypad driver name>.kl file and map the keys accordingly in decimal format because getevent show in hex format. Example->

key 256   MENU               WAKE
  1. where key is common key word
  2. where 256 is decimal equivalent of the value obtained through getevent
  3. where MENU is Android key Code
  4. where WAKE is policy flag, stating that this key can wake the device up

Q: How to get USB Event and change node permission in android ?

Create ueventd.<yourboard>.rc file in (device/ti/yourboard/) folder and copy this file in root directry of filesystem with the help of file create a copy entry below in PRODUCT_COPY_FILES line file.


add  the line ueventd.<yourboard>.rc file  
/dev/video0         0666  root       root 
  1. where /dev/video0 is node
  2. where 0666 is premission
  3. where root is system
  4. where root is radio

Q: How to get USB stick installed ? How to install apk residing on USB stick ?

Ans: :
a) In the init.rc file do the following changes as shown with '+' sign (patch)

# mount sdcard third partition on /part-3
      mkdir /part-3
 +    mkdir /usbmountd
      mount vfat /dev/block/mmcblk0p3 /part-3/
  # mount mtd partitions
 @@ -361,6 +369,9 @@
  on property:persist.service.adb.enable=0
      stop adbd
 +on device-added-/dev/block/sda
 +    service usbmountd /system/bin/usbmountd start
  service servicemanager /system/bin/servicemanager
      user system

b) Create a new file /system/bin/usbmountd and copy the below

 case "$1" in
         mount -t vfat /dev/block/sda1 /usbmountd
         umount /dev/block/sda1
         echo "$0: unknown argument $1." >&2;

Make sure that /system/bin/usbmountd has executable permissions

c) Use the Filemanager app#,when you browse the USB folder, it should show the .apk file, just click on this, it will install the application on the device directly.

Q:How to add/configure LCD touchscreen ?


Q:How to add or port radio layer interface on android ?

Ans: :

Q:How to add ethernet support in settings for android gingerbread ?

Ans:Refer to patch given at#

Q:How to come out of Airplane mode ?

Ans:On our platforms it is currently not possible to disable Airplane mode if it is enabled.

To reset the Airplane mode setting, follow the following steps:

Boot the device and on the serial console (or adb shell console), enter the following commands shown in bold:

  # sqlite3 /data/data/*/*/settings.db
  SQLite version 3.6.22
  Enter ".help" for instructions
  Enter SQL statements terminated with a ";"
  sqlite> delete from system where name='airplane_mode_on';
  sqlite> .exit 

Reboot the board. Now the Airplane mode setting is reset.

Q: Sliding to camera gives error on ICS unlock screen

Ans: Make sure that the camera module as appropriate is correctly installed on the board.

If your device not have a camera, you can set android to use the stub camera as follows:

   sudo cp <rootfs path>/system/lib/hw/ <rootfs path>/system/lib/hw/

Ensure that is not present in /system/lib/hw directory, if you do not wish to support camera module. Only should be present.

Build Errors

Build error on 64-bit machine

One need to have following packages to be installed in order to build android on 64-bit machine.

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev g++-multilib lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev libsdl-dev sun-java5-jdk libesd0-dev libwxgtk2.6-dev libncurses5-dev zlib1g-dev tftpd uboot-mkimage


Error 41 
make: *** Waiting for unfinished jobs.... 
cannot access java.lang.Object 
bad class file: java/lang/Object.class(java/lang:Object.class) 
unable to access file: corrupted zip file 

Ans: run "sudo update-alternatives --config jar" and select the corresponding jar tool from the 1.6 JDK you're using. This should fix things enough for you to do a clean build of things at that point.


host C: acp <= build/tools/acp/acp.c
In file included from /usr/include/features.h:388:0,
                 from /usr/include/stdlib.h:25,
                 from build/tools/acp/acp.c:11:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] Error 1


$sudo apt-get install libc6-dev-i386

Error: cannot stat pvrsrvkm.ko

cp: cannot stat `android/hardware/ti/sgx/eurasiacon/binary2_omap4430_android_release/target/pvrsrvkm.ko': No such file or directory
make[1]: *** [buildkernel] Error 1
make[1]: Leaving directory `android/hardware/ti/sgx'
make: *** [sgx] Error 2

Ans: Go to "android/hardware/ti/sgx/"

Apply this following patch:

From 0eb2b92716e27e3ef60661ecbbc678dd4a23f046 Mon Sep 17 00:00:00 2001
From: Umakanta Patro <>
Date: Wed, 29 Aug 2012 15:55:13 +0530
Subject: [PATCH] Solve issues with OUT variable

This patch fixes the following issue:

cp: cannot stat `android/hardware/ti/sgx/eurasiacon/binary2_omap4430_android_release/target/pvrsrvkm.ko': No such file or directory

Signed-off-by: hedwin <>
Signed-off-by: Umakanta Patro <>
 eurasiacon/build/linux2/config/ |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eurasiacon/build/linux2/config/ b/eurasiacon/build/linux2/config/
index bf9e0b9..2d56b1a 100644
--- a/eurasiacon/build/linux2/config/
+++ b/eurasiacon/build/linux2/config/
@@ -179,7 +179,7 @@ $(call directory-must-exist,$(TOP)/eurasiacon/build/linux2/$(PVR_BUILD_DIR))
 # final programs/libraries, and install/rc scripts.
 BUILD	?= release
-OUT		?= $(TOP)/eurasiacon/binary2_$(PVR_BUILD_DIR)_$(BUILD)
+OUT	:= $(TOP)/eurasiacon/binary2_$(PVR_BUILD_DIR)_$(BUILD)
 override OUT := $(if $(filter /%,$(OUT)),$(OUT),$(TOP)/$(OUT))
 CONFIG_MK			:= $(OUT)/


Q:How to start android application from command line or console ?


am start -a <action> -n <component>/<intent>
am start -a android.intent.action.MAIN -n package/class_fullname
am start -a android.intent.action.MAIN -n

Q: How to auto disable key guard/screen lock after android boot? How to see home screen instead of screen lock after android boot ?

Ans: Kindly apply following patch in frameworks/base and rebuild your android system.

With this patch applied, the keyguard will not appear on
boot or after suspend-resume.

Signed-off-by: Vishveshwar Bhat <>
 .../internal/policy/impl/ |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/policy/src/com/android/internal/policy/impl/ b/policy/src/com/android/internal/policy/impl/
index 9d10ce5..fbfc817 100644
--- a/policy/src/com/android/internal/policy/impl/
+++ b/policy/src/com/android/internal/policy/impl/
@@ -553,7 +553,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
             if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen");
-            showLocked();
+            //showLocked();

Q:Any link for getting started on porting android for new mobile device ?


Q: How to use mplayer command to play the camera video?

#mplayer tv:// -tv driver=v4l2:width=480:height=272:device=/dev/video0

Q: How to launch a video/audio clip from gallery from command line?


$am start -n -d /sdcard/myvideo.mp4
$am start -n -d  /sdcard/song.mp3

Q: I get this error: ./ /bin/bash^M: bad interpreter: No such file or directory

Ans:Your mkmmc-android script is in DOS-format. This is perhaps because you originally extracted this file in a Windows PC. This does not work for executable shell scripts in linux. You can convert this to unix-format using the following command:

$ dos2unix
$ chmod a+x

In case you do not find dos2unix in your ubuntu repositories follow the steps here :

Q: How to read contents of boot.scr

Ans: boot.scr is just a set of u-boot commands wrapped within the u-boot uImage executable format. You can easily read the commands embedded in it by directly opening boot.scr in any text editor or by dumping the contents directly on screen as follows:

$ cat boot.scr

You will see only the ASCII contents of the file which is mostly the u-boot commands.

Q: Android Tips to improve user experience


Q: How to switch off android device from console ?


#am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN


References : boot chart