Conversion to Dalvik format failed with error 1


Using android on eclipse can be frustating sometimes.You create a new
android project and just cant get it to build, run or clean out the errors
eclipse shows up. Most of all, you can get vague errors like the below.

Conversion to Dalvik format failed with error 1
Could not *find* HelloAndroid.*apk*
Updates (from 0.9.1. to 0.9.5) dont work, vague error there too some
org.eclipse.something is not linking (google, if you are hearing, just do a
google search out there find out the issues people are facing). Uninstalls
dont work.

Did a research :), to figure out how to fix it. Found many that
helped, found many that did not. And I am not alone there.

So this is what I did and it worked.
– Close all projects
– Restart Eclipse
– Uninstall both Android under Help-SoftwareUpdates
– Restart Eclipse
– Uncheck all under Help-SoftwareUpdates-AvailableSoftware, except the
dl-sslgoogle one, install it
– Restart Eclipse
– Create a new project now, same problem eh!! 🙂
– In the root directory of the project you just created, open the .classpath
file. Change it to the following

<?xml version=”1.0″ encoding=”UTF-8″?>
<classpathentry kind=”src” path=”src”/>
<classpathentry kind=”src” path=”gen”/>
<classpathentry kind=”output” path=”bin”/>
<classpathentry kind=”con” path=””/>
– Main Menu – Project – Clean
– Project Explorer – – Right Click –
Properties – Android – Check Android 1.5 – Hit Apply (a lot of magic happens
in the console tab on the project)
– Project Explorer – – Right Click –
Properties – Java Build Path – Libraries – Verify if you see a “Android 1.5”
and not a “android.jar”.
*The only way to add a “Android 1.5” is to edit the classpath file. Google,
you should fix this. It would be nice to know what “Android 1.5” signifies
here, a jar, external jar, variable, class folder, external class folder or
library(usability issue, think about it, how do I add a Android 1.5 from UI,
no way now right). Also it would be nice if the create new android project
would fix this automatically.*

Logged a bug on android,

Hibernate Getting Started, basic fundamentals


My expectations : My Server has some data which I need my clients to access. Now, obviously first technology I need to explore is JDBC. So I went to the site, and guess what they advice use of Hibernate. So I need to learn Hibernate. The first definition I came across is “Hibernate is a solution for object relational mapping and a persistence management solution or persistent layer.”

This is probably not understandable for anybody learning Hibernate.

So persistence means, saving data to database. That way data is persisted, and not lost on a reboot :). Simple. And “object relational mapping” means copying of tables from database to method variables of a object. Thus making it dead easy to use the data in code.

The main reason to use Hibernate on a server platform is to get rid of the complex JDBC hell hole. The only reason you thought u needed a object relational mapping solution was to get some neatness in code and good old re-usability built into the design. So in short, for Android, people roll up your sleeves and get using some design patterns to get re-usability the right way. There is no short cut 🙂

Research to rule out

So how to get started with Hibernate. Found one fantastic blog to get started with Hibernate, now I can focus on my table design :). But MyEclipse is a priced product :). So personally I had to skip it for now. I researched more and got Hibernator. Tried Hibernator which is a eclipse plugin to make Hibernate integration super easy (seemed too good to be true), but turned out to be a disaster. Gave it up. Also noticed that the code was as old as 2006, no one working on it now.

Finally, I hit GOLD

Then moved to Hibernate Tools from JBoss Hibernate Tools – worked like a charm.

To get hibernate working you need to understand 3 parts of hibernate

1) file : This helps you connect to your database. Select your database, server location where it is hosted, root login, password and other connection properties.

2) hibernate.hbm file : This helps you connect your tables to your objects. All you need is reference the classpath of your java class (POJO) with your table. And then connect each variable to columns. Hibernate also needs to know which column is a the primary key, and the type of each variable.

3) The hibernate library calls, to connect the database, and pass on a reference which you can use in your code to write and read from. As you want to write to the database, you need create objects and call the hibernate <b>save</b> call to issue the write transaction.

Strategy Pattern (Initial thoughts on a Client Server architecture)


Any client server application needs to pass requests and await responses between the client and server. Use of the Strategy Pattern, can do a good job here. So, I am thinking, keep the code neat, encaptulate the request code, request data and response processing in just one class. Abstract the server from adding, modifying new requests from client. Obvious benefit, the server need not be modified for new requests added by the client, and multiple developers working on the client code.

Anyone want to take up the challenge of designing such a architecture ?

Ever think, which design pattern was most used OR even better, should I use an abstract class or an interface ?


Busy with relocation, just got my internet connection working :).

One interesting topic I always wanted to read on the net was about which design patterns are the most famous and I wanted to avoid discussions and articles that have “depends on situation”. I just cant accept that answer, depends.. :). So here is my take on last 6 years of its use.

Strategy pattern is the most used. Yeah! Yeah! you will argue on the MVC, but come on have you actually implemented the MVC, no you haven’t in true sense. What you have implemented is the MV model, not the C. You may have used the MVC implemented by frameworks right? So don’t give me that argument. And yes, don’t even start about the Singleton, if you have used it, you will know the lesser you have and lesser you need pattern in a product. I mean how many singleton’s can you or will you or should you have in an application right ?

Strategy for me is fantastic use of future growth, re-usability and abstraction. The question that I had was, is it better to use an interface or an abstract class when implementing the Strategy pattern? The answer is simple, if you have future growth needs for your customizable design, you will most definitely have come common behaviour for each of those who are sharing the signature, so use of interface is lame. I would always use an abstract class. Now lets see you debate that.. 🙂 Comments please.