FYI ---------- Forwarded message ---------- From: Matt Hellige <[EMAIL PROTECTED]> Date: Nov 13, 2007 12:09 PM Subject: [scala-lounge] Re: [scala] Scalandroid To: [EMAIL PROTECTED]
On Nov 13, 2007 1:02 PM, David Pollak <[EMAIL PROTECTED]> wrote: > The Android VM reads JVM bytecode and converts it into DEX format. > > There's no reason that Android can't run any JVM language unless that > language is dynamically creating bytecode at runtime (this is a > questionmark.) There's a discussion of this issue on the JVM Languages list > right now. (moving to the lounge...) I've actually just tried this. The short answer is that it's going to take at least a little work, and maybe a lot. I generated the sample activity using the Android scaffolding scripts, hacked up the build.xml a little bit and ported the main Activity class to Scala. Everything compiled fine and installed to the emulator, but I got denied : NoClassDefFoundError. I figured this is likely a missing scala-library.jar, so I extracted just scala.ScalaObject and scala.ScalaObject$class and packaged them up with my own classes. This fixed the NoClassDefFoundError, but now I get something worse. The onCreate() method of each activity must call super.onCreate(). The phone checks for this and throws an exception otherwise. But if I try to call super.onCreate() in my Scala code, I get a NoClassDefFoundError. Of course the same code works fine in Java. The bytecode looks similar from javap, but clearly there's something going on. It might be as simple as writing some wrapper code in Java and then delegating to Scala, but this makes me worry that the dx compiler does depend in subtle ways on the bytecode. Unfortunately, I don't have any more time to play with this today. I'd love to learn that it's something simple. Happy hacking... Matt -- Matt Hellige / [EMAIL PROTECTED] http://matt.immute.net -- lift, the secure, simple, powerful web framework http://liftweb.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---
