2011年2月13日日曜日

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

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

※本ブログは6月末で他サイトに移設する予定です。これまで閲覧ありがとうございました。
[note] this blog is planed to be moved to other site until end of June. See you in there

今回本当にハマリました。
[I got a deep pitfall]

いろいろ調べてeclipseのキャッシュクリーンなどもやった。おかげでworkspaceからprojectが消えてしまって、全クリアかと一瞬あせったりした(作業ファイルが消えただけだったのほっとした)。
[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
OK]

最初は

Conversion to Dalvik format failed with error 2

でGooglingしていて、上のような情報しか得られず(非常に有用なんだろうけれど今回の問題には的外れ)、途方に暮れて、もうほとんど「仕方ないのでprojectから1ファイルずつ削って現象が変わるか調べよう」などとtediousな時間を過ごす覚悟を決めたとき、なんとなくエラーを見ていて、

trouble writing output: shouldn't happen

も出てるなあと気づいて(実は最初から出てました)、これでGooglingしてみた。
[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]

すると下の記事にあたり、一瞬で解決してしまった。結局ある意味eclipseのバグなんだろうけれ(人間の造ったものには)そういうことはなくならないので文句を言っても仕方がない。

それより、eclipseのお陰で、アプリ開発時に(実行時の不可思議な現象で困るのではなく)コンパイル時の警告で済んでいることを改めて感謝した、数時間でした。
[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)]

http://codeandroid.wordpress.com/

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);


#bloggerでのソース引用の方法がわからず、見づらくてすみません。

私の場合は、

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

などしていてこれにハマりました。

bEstRegards

0 件のコメント:

コメントを投稿