Hi all:
Yet another very interesting post on how to setup
Scala on Android environment.
Steps suggested by Robey:
First, copy scala-compiler.jar and scala-library.jar out from
your scala-home and into your android project folder. Since the
compiler is only needed for building, and the library is the
only one you'll need installed, I made a folder for the compiler
and put the library in libs/.
$ mkdir scala-compiler
$ cp $SCALA_HOME/lib/scala-compiler.jar scala-compiler/
$ cp $SCALA_HOME/lib/scala-library.jar libs/
Second, edit build.xml and change the compile task to look like this:
<target name="compile" depends="dirs, resource-src, aidl">
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
srcdir="${srcdir}" includes="**/*.java"
destdir="${outdir-classes}"
bootclasspath="${android-jar}">
<classpath>
<fileset dir="${external-libs}" includes="*.jar"/>
</classpath>
</javac>
<taskdef resource="scala/tools/ant/antlib.xml"
classpath="scala-compiler/scala-compiler.jar:${external-libs-ospath}/scala-library.jar" />
<scalac force="changed" deprecation="on"
srcdir="${srcdir}" includes="**/*.scala"
destdir="${outdir-classes}"
bootclasspath="${android-jar}">
<classpath>
<fileset dir="${external-libs}" includes="*.jar"/>
</classpath>
</scalac>
</target>
Third, you need to edit dx from the android toolkit so that it
gets lots of memory. Uncomment the line with the java heap
option and give it a lot of memory, like 512MB ("-Xmx=512m"). It
needs this because dex is going to convert the entire scala
library into dalvik. Without a lot of memory, it will run out of
heap space.
Checkout the complete post here
http://robey.livejournal.com/54348.htmlthanks
Saifi.