Android tips

HowTo take a screenshot on Android device

On Ice Cream Sandwich (4.0) or above, press the Volume Down and Power buttons at the same time and hold them for a second.

Deploying Android SDK on Ubuntu (32bit)

$ mkdir ~/projects/android
$ cd ~/projects/android/
$ cp ~/Downloads/Android/adt-bundle-linux-x86.zip ./
$ unzip adt-bundle-linux-x86.zip
  • Install JDK (copy jre directory) into ./eclipse subdirectory
  • Install necessary packages for building project from command line
$ sudo apt-get install ant
$ sudo sudo apt-get install default-jdk
  • Make sure binaries are accessible
$ echo $PATH
/home/dambi/bin:...
$ ls -l /home/dambi/bin/android
lrwxrwxrwx 1 dambi dambi 58 Dec 24 09:36 /home/dambi/bin/android -> ../projects/android/adt-bundle-linux-x86/sdk/tools/android
$ ls -l /home/dambi/bin/adb
lrwxrwxrwx 1 dambi dambi 63 Dec  5 16:57 /home/dambi/bin/adb -> ../projects/android/adt-bundle-linux-x86/sdk/platform-tools/adb
$

Managing Android project

  • Create project
$ android create project --target 1 --path ~/projects/CarMon/sw/app/android/ObdLogger --activity ObdLogger --package cz.tio.android.obdlogger
  • Build debug version and install it into device
$ ant debug install

Debugging

  • display whole log
$ adb logcat
  • filter out irrelevant messages
$ adb logcat -s ObdLogger:*

Devices

Enable logging on Huawei Ascent G300

Logging feature is disabled by default on that device.

$ adb logcat
Unable to open log device '/dev/log/main': No such file or directory
$

Though logging can be enabled from hidden service menu.

  • Activate hidden menu by dialing *#*#2846579#*#*
  • Enable logging: ProjectMenu → Background setting → Log setting → Log switch → LOG on
  • Set desired log level: ProjectMenu → Background setting → Log setting → Log level setting
  • Reboot device
notes/android_tips.txt · Last modified: 2013/11/04 21:29 by admin
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0