some basic info about Clojure on Android

356 views
Skip to first unread message

John Gabriele

unread,
Nov 27, 2012, 1:49:45 PM11/27/12
to clojure...@googlegroups.com
Hi,

Was just looking into Clojure on Android, and was hoping I could get
some answers to some basic questions. :)

Does the jvm bytecode that ClojureJVM produces directly run on Dalvik?

If not, is the bytecode translated in some way? If so, how (that is,
with what tools)?

What's the typical way to go about creating an Android app using
Clojure? Write a regular Java Android app first then add the Clojure
stuff later?

Thanks!
---John

thomas kalbe

unread,
Nov 27, 2012, 3:46:21 PM11/27/12
to clojure...@googlegroups.com
I can't answer your first two questions, but to create apps, I would
recommend to write the main activity in Java and store all your Clojure
code in a jar file.
I use leiningen to create a jar containing my Clojure code and then I
write a Clojure class (using gen-class) as an interface between Java and
Clojure.
Copy the jar (not the uberjar) and clojure.jar to your Android project's
lib directory and you should be set.

Right now I'm having a small (test) app in the store (EpguideWidget) and
about to release a more complex app (a game) soon.
For both I used Clojure and the Leiningen method.

You can also write your app entirely in Clojure using saatvik's Neko for
compilation, but
Neko has not been updated for more than 6 months and it does some
things under the hood which I just do not understand right, so it just
costs me too much time to hassle with Neko errors.

- thomas




John Gabriele

unread,
Nov 28, 2012, 8:54:42 AM11/28/12
to clojure...@googlegroups.com, thomas...@googlemail.com
On Tuesday, November 27, 2012 3:46:21 PM UTC-5, thomas kalbe wrote:

I can't answer your first two questions, but to create apps, I would
recommend to write the main activity in Java and store all your Clojure
code in a jar file.
I use leiningen to create a jar containing my Clojure code and then I
write a Clojure class (using gen-class) as an interface between Java and
Clojure.
Copy the jar (not the uberjar) and clojure.jar to your Android project's
lib directory and you should be set.


Thanks for these instructions, Thomas! Will look into it.
 
You can also write your app entirely in Clojure using saatvik's Neko for
compilation, but
Neko has not been updated for more than 6 months and  it does some
things under the hood which I just do not understand right, so it just
costs me too much time to hassle with Neko errors.

Was wondering what Neko is. Thanks. Also, looks like this fork https://github.com/alexander-yakushev/neko got some commits last month.

---John

Alexander Yakushev

unread,
Nov 29, 2012, 10:51:20 AM11/29/12
to clojure...@googlegroups.com
Hello John,

The simplest way to start off with Android/Clojure development is to use lein-droid plugin (https://github.com/alexander-yakushev/lein-droid/wiki/Tutorial). Once you managed to run your template application on Android you can proceed with using Neko. This is my fork of it that will soon be merged with Daniel's original version: https://github.com/alexander-yakushev/neko.

Feel free to ask me any questions on Clojure/android, lein-droid and neko either here, by mail or on relevant Github pages.

Kind regards,

John Gabriele

unread,
Nov 29, 2012, 6:20:43 PM11/29/12
to clojure...@googlegroups.com
On Thursday, November 29, 2012 10:51:20 AM UTC-5, Alexander Yakushev wrote:
Hello John,

The simplest way to start off with Android/Clojure development is to use lein-droid plugin (https://github.com/alexander-yakushev/lein-droid/wiki/Tutorial). Once you managed to run your template application on Android you can proceed with using Neko.

Interesting. Thanks. I've emailed you off-list regarding a bit more overview, but will also give this a try and compare lein-droid's output to what Google's ADT bundle gives me.
 
This is my fork of it that will soon be merged with Daniel's original version: https://github.com/alexander-yakushev/neko.


Oh, nice. :)
 
Feel free to ask me any questions on Clojure/android, lein-droid and neko either here, by mail or on relevant Github pages.

Much appreciated, Alexander. And thanks for all your work on these projects!

---John

 
Reply all
Reply to author
Forward
0 new messages