Nov 9, 2009

Problems running Android SDK on a Mac

You might encounter a problem when trying to install and run the Android SDK on your Mac like me yesterday. The symptom is like when you're trying to run the "android" command line tool, it says the following text and then does nothing:


dll-book:~ dll$ android Developer/android-sdk-mac/tools/android 
Starting Android SDK and AVD Manager
No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.

The solution is simple - "android" is a shell script which contains a hardcoded path to a Java 1.5 executable. However, due to bug in SWT, it does not run under OS X 64 bit JDK 1.5 and since android's UI is SWT based, it does not run either.

To solve the problem, simply open the "android" executable in any text editor (it is a simple shell script), then find and replace the path to 1.5 JDK to a path to 1.6 one. It is easy to perform a search for the phrase "java_cmd" in your text editor and you'll find it. Once 1.5 changed to 1.6, everything works just fine.

Oct 20, 2009

SVN file rollback

This is quite often operation, however, this is also a most asked question - "I just broke a build by my commit, how can I rollback my changes ?" The answer is simple, but you just need to use command line svn client instead of your favorite IDE-embedded one.  Let's say, you just comitted an updated version of Bullshit.java and it broke the build. How to rollback quickly ?

1. Navigate to bullshit.java package folder:

cd com/myapp/bullshit

2. Check current revision of broken file (let's assume, the current broken revision is 500):

svn info Bullshit.java

3. If required, ensure that previous revision is the correct working file:

svn diff -r 499:500 Bullshit.java

4. Get back the previous revision of the file:

svn merge -r 500:499 Bullshit.java

5. Commit file and fix the build:

svn ci -m "I fixed the build"

And in some cases, you'd want to rollback entire trunk or folder - in this case, it it easier to do the following actions:

1. Delete current folder or trunk:
svn delete svn://svn.host.net/some/project

2. Restore deleted folder by copying appropriate revision from history:

svn copy svn://svn.host.net/some/project@24 protocol://svnserver/some/


where 24 - is a proper revision number you want to make current.

Oct 16, 2009

public static void main ( String args[] );

Finally decided to start putting some technical on-the-go thoughts, testcases and ideas to the web, just in order not the get them lost and in case this will be helpful for anyone else. So, here is the main method invoked :)