I got this error when i ran the following command

android creat avd -t 2 -n my_avd

And this was the error

Exception in thread “main” java.lang.AssertionError
at com.android.sdkmanager.CommandLineProcessor.define(CommandLineProcessor.java:758)
at com.android.sdkmanager.SdkCommandLine.<init>(SdkCommandLine.java:96)
at com.android.sdkmanager.Main.init(Main.java:125)
at com.android.sdkmanager.Main.run(Main.java:80)
at com.android.sdkmanager.Main.main(Main.java:72)

Solution : Run the following command

sudo update-alternatives –config java

What it does is you will be given the choices between the existing Java Versions already installed in your system. And by choosing the right version (by typing a number from the list) solves this error. This becomes the default option of the system and so the whole thing gets right.

Thanks to : http://osdir.com/ml/AndroidBeginners/2009-06/msg00587.html