Android Build Error

I tried building one of my projects for Android, and I get this error:

Error building Player: Exception: android (invokation failed)
ERROR: unknown error
cmd:android list target -c
stdout;
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
stderr:

I tried creating a new Unity project with no changes, and when I try to build it for Android, I get the same error. I am prompted for the android sdk, and the build fails immediately after I select the sdk directory. I tried updating my sdk through Eclipse, and I even tried downloading the sdk separately, and everything I try results in the same error.

I am using Unity 4.1.2f1 with an Android license.

Roll back your Android SDK to revision 21 and it should work fine

I went to the Java web site and installed Java 7 Update 21. That, by itself, didn’t fix the problem but before I installed it, they recommended removing an old version of Java that was still on my PC. As soon as the old version of Java was uninstalled, the problem went away, and I can load games on my Android devices now without any problems.