Thursday, August 16, 2012

Enable HierarchyViewer on production builds

For security reasons HierarchyViewer does NOT work on production builds. It works only with userdebug and engineering builds (this includes the emulator.)

In this case you’ve got the following errors:
[hierarchyviewer]Unable to get view server protocol version from device
[hierarchyviewer]Unable to debug device

But there is a way to enable the use of HierarchyViewer inside your own application. Romain Guy suggests to use ViewServer class:

Thursday, August 2, 2012

Downloading the Android sources behind a proxy

Manual for Windows

The simplest way to get the Source Tree for Windows is to use Cygwin

1.       Download Cygwin web installer from and run it
2.       You can install packages from Internet using IE proxy settings
3.       Specify the root directory – things will be easier if the path to it won’t contain spaces
4.       In addition to default packages you will need the following:  bash, curl, git and python. The installer will automatically resolve the dependencies.
5.       After installation you will have “Cygwin bash shell” link in Main Menu. Run it
6.       Type cd in command prompt to be sure you are in your home dir – usualy it is your “My Documents”
7.       Create file .bash_profile in this dir with following contents:
export PATH=/usr/bin:~/bin:$PATH
export http_proxy=proxy:port
proxy:port is name and port of your proxy server
8.       Reopen the Cygwin shell and cd to your home dir

Tuesday, July 17, 2012

Android NDK

The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++ (
You will also need Eclipse CDT Plugin installed to build C/C++ native part from Eclipse. To install it use menu Help -> Install New Software..., then setup CDT Main Features from URL.
The Java Native Interface
 Programmer's Guide and Specification
shows a simple example of using the Java Native Interface:

Let’s go through all these steps.