« Return to Thread: [scala] Scala on Android

[scala] Scala on Android

by Stéphane Micheloud :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View in Thread

Hi everybody,


Scala version 2.6.1-RC2 provide sbaz packages for the Android,
J2ME/CDLC and MSIL target platforms.

    http://www.scala-lang.org/downloads/targets/


NB. As a reminder release candidate versions of the Scala software
     are made available from the "lamp-rc" universe. More information
     can be found on the page

        http://www.scala-lang.org/downloads/sbaz.html


Let's now try the example "NotePad" adapted (Scala sources) from
the Android distribution (works both on Unix and Windows):

sbaz> bin/sbaz showuniverse
SimpleUniverse "lamp-rc" (http://scala-webapps.epfl.ch/sbaz/lamp-rc)

sbaz> bin/sbaz install scala-android
planning to install: scala-android/2.6.1-RC2
Installing...


sbaz> cd doc/scala-android/examples/NotePad/
NotePad> ls
total 40
-rw-r--r-- 1 4740 2007-12-14 14:29 AndroidManifest.xml
-rw-r--r-- 1 8474 2007-12-14 14:29 build.xml
drwxr-xr-x 6 4096 2007-12-14 14:02 res/
-rw-r--r-- 1 6743 2007-12-14 14:29 sample_notepad.png
-rw-r--r-- 1 3973 2007-12-14 14:29 sample_note.png
drwxr-xr-x 3 4096 2007-12-14 14:02 src/

NB. The (user-specific) Ant script file "build.xml" was generated
as described on the page:

        http://www.scala-lang.org/downloads/targets/android.html


NotePad> ant
Buildfile: build.xml
[..]
package-dex:
      [echo] Packaging dex...

package:

BUILD SUCCESSFUL
Total time: 1 minute 14 seconds


NotePad> ls bin
total 8436
drwxr-xr-x 5    4096 2007-12-14 14:30 classes/
-rw-r--r-- 1 4704310 2007-12-14 14:31 classes.dex
-rw-r--r-- 1 1032485 2007-12-14 14:31 NotePad.apk
-rw-r--r-- 1 2864514 2007-12-14 14:30 NotePad.jar

NotePad> emulator &
NotePad> adb install bin/NotePad.apk

NB. Both "emulator" and "adb" are Android commands located in
     directory $ANDROID_HOME/tools/.


Bye
--Stephane

 « Return to Thread: [scala] Scala on Android