Wednesday, July 22, 2015

Android Studio: Ill-advised or mistaken usage of a core class (java.* or javax.*)

Adding xmlrpc-client library to the application
                               compile 'org.apache.xmlrpc:xmlrpc-client:3.1.3'
causes the following error during run:
trouble processing "javax/xml/parsers/DocumentBuilder.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)

DocumentBuilder is already included in android. So we should exclude xml-apis in gradle:

compile ('org.apache.xmlrpc:xmlrpc-client:3.1.3') {
    exclude group: 'xml-apis'

Wednesday, July 15, 2015

Livejournal XML-RPC anonymous access

The question about anonymous access (i.e. read posts and comments without authorization) is often raised during development applications using XML-RPC interface. Livejournal protocol is poorly documented and it is not obvious how to implement that. However source code is available and could help to clarify some issues (LiveJournal Server Source Code (stale history from before it went closed-source) ( The file is of interest to us.

Friday, July 10, 2015

Android Studio: Android application with Java library

This is a short guide how to set up Android Studio for developing Android Applications that depend on the Java library.

Add Java library to the Android application

 Add new module using File -> New -> New module

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.

Friday, December 16, 2011

Content Providers

 Content providers expose their data as a simple table on a database model, where each row is a record and each column is data of a particular type and meaning. So you can create Content Provider that will work with database stored under /data/data/package_name/databases directory.