ical4j を Androidで使うのにあれやこれやと

以下、メモを殴り書き。(もちろんJavaのこと)

========================================================
iCal4j - Introduction






https://github.com/ical4j/ical4j-vcard.git


========================================================
com.sun.istack.internal.NotNullのclassが見つからない件は
eclipseの環境設定からbuild pathのLibrariesのところで
「Add Librariy」してJRE System Library をローカルから加えて解消したはず。たしか。


========================================================
ある時、下記のように言われた。
Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
どうやら「メソッドが多すぎて無理」ってことのもよう。

Your project is too large. You have to many methods. There can only be 65536 methods per application. see here https://code.google.com/p/android/issues/detail?id=7147#c6

 ========================================================
ical4j-1.0.5に同梱で配布されてるライブラリを全部libsに入れて実行しようとした時の話。
こんな感じの「インナークラスがなんとか」というエラー。


Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.codehaus.groovy.tools.shell.util.HelpFormatter$_renderOptions_closure4) that doesn't come with an associated EnclosingMethod attribute.

これが頻発してGC走りまくって、そのままヒープが足りなくなってアボーン。
続きのメッセージをコピるの忘れたけど、内容は「なんか古いみたいだからrecompileした方がいいよ」とかなんとかゆってたはず。配布されてるjarファイルをcompileし直すなんて大変(ノД`)

とりあえず依存ライブラリをいったん全部とっぱらって、一つずつ加えながら実行してみると grooovyを組み込んだところで件の症状が発生してるようだとわかった。
調べてたら下記ページにてindyとかいう機構に行き当たる。

Groovy 2.0でindyを使う - uehaj's blog 
http://uehaj.hatenablog.com/entry/20120813/1344846148

ひとまず最新のgroovy-2.2.2-indy.jarに置き換えたら、解消したっぽい。



========================================================
とある環境でproject実行すると、こんなエラーでAndroidへのインストールが始まる前にアボーン。
Conversion to Dalvik format failed with error 1

StackTraceを見た限り、ical4j関連のパッケージに起因してるよう。
そこで下記を参考に対処してみたら、解消したっぽい。

【備忘録】 “Conversion to Dalvik format failed with error 1” on external JAR: リターンライダー = [路麺 プログラミング : ZRX1200];
http://kevin99.cocolog-nifty.com/mydiet/2012/08/conversion-to-d.html

1、ソースパス内に /libs ディレクトリを作ってJARを置いていたものを
2、ソースパスの外に適当なディレクトリを作ってJARを移動
3、Package Explorerからプロジェクトを右クリック-[Properties]-[Java Build Path]を開き、設定済みのJARを全部いったんRemove
4、外部ディレクトリに置いたJARを "Add External JARs…"で追加
念のため、Clean & Automatic Build



コメント

このブログの人気の投稿

LaravelのTestCaseを継承したテストにて use RefreshDatabase を使って artisan db:seed --class='TestSeeder' まで実行させるやり方

ZF3で空のプロジェクトを作成する自分なりの手順

Androidでical4jを使う