0

I have written a clojure program that performs data manipulations of some complexity.

I would like to bring this functionality to my phone.

As an alternative to having to reimplement the whole code in java, I thought it would be nice to use clojure to generate a library to be called from Java. This would also prevent me from having to keep two versions of the same functionality in sync during the development process.

The general idea:

The java-part of the app passes a JSON-String to Clojure; The clojure-part performs the data manipulations in and then returns a JSON-String back to java.

Question: Is this possible? If so: How?

Edit: Note that the question is not about building a whole android app in clojure but rather about exposing clojure functions to an existing java/android app.

Gerrit Begher
  • 363
  • 2
  • 14
  • 2
    I don't think you've done sufficient research prior to asking you question. A routine Google search for "using clojure library on an android phone" yields several useful results. – Robert Harvey Dec 15 '14 at 21:50
  • a good overview and tutorial here: http://clojure-android.info/ which covers using the lein-droid leiningen plugin. – Arthur Ulfeldt Dec 15 '14 at 21:51
  • Thank you; I had a look at the respective libraries but I found only information on how to build an android app in clojure. Instead I would like to expose some functions written in clojure to an existing java/android project. Could you provide me with a link on this topic? – Gerrit Begher Dec 15 '14 at 22:05
  • Garlef, do you mean that you want to know how to bundle some Clojure functions into a library that can be called from a Java app running on Android? – Mars Dec 17 '14 at 16:30
  • Yes, I figured it out: Use gen-class and compile the project with "lein uberjar" and ":aot :all" in the project.clj. Then add the .jar as a library to the android project. It will provide the funcionality as a class. – Gerrit Begher Dec 17 '14 at 16:35

0 Answers0