本当にハマった。Conversion to Dalvik format failed with error 2 [I got deep pitfall in developping android app.]

[I got a deep pitfall]

[When I got the msg on the title, I had been googling several hours. I got someone recommend using cache clean option of eclipse system. When I found all project gone from workspace, I have got stunned, but it was


Conversion to Dalvik format failed with error 2


trouble writing output: shouldn’t happen

[When I almost go into something like tedious work on this, I realized that I got another msg on top of the error msgs.  “trouble…..”.  I have googled again, I got BINGO, the article at the bottom]


[I appleciate that using eclipse system, without having tedious work, I can develop app. just getting tens of errors and warnings on compiling(typing?  should be better)]


Weird Dalvik format failed error
Published October 13, 2009 Android 1 Comment
Tags: 2, Android, Dalvik, error, fail, format, output, trouble, writing
Strange Android error I came across tonight(or should I say this morning :s).
[2009-10-13 03:18:29 - TestAccelerometer]trouble writing output: shouldn’t happen
[2009-10-13 03:18:29 - TestAccelerometer]Conversion to Dalvik format failed with error 2
[2009-10-13 03:18:29 - TestAccelerometer]
trouble writing output: shouldn’t happen
[2009-10-13 03:18:29 - TestAccelerometer]Conversion to Dalvik format failed with error 2

The error occur when I save my Activity (I have auto-build on, so it could be either the saving or building process).
Like a lazy programmer would do, the first thing I do was trying to find the error on Google. Couple of exact error found but no relation can be found since the root cause is entirely different.
After a few comments & builds tries I found that the problem comes from the following line
size = (size > 10? size = 10: size);


s=(s==null || s.length()==0)?s="":s;