Chris Biscardi

moon indicating dark mode
sun indicating light mode

Common Lisp on Android: Running the MOCL Android Example

Prereqs: Install ADK, Android NDK, and mocl.

git clone the sample app somewhere:

git clone https://github.com/Wukix/mocl-example-lisp-contacts-android.git

Import the cloned app into Android Development’s version of Eclipse. Note: at this time there are may or may not be issues with creating a new project in ADK due to Gradle not supporting the NDK.

My third party library install location is mocl/systems.

Install Common Lisp dependencies there:

$ cd mocl/systems
$ git clone https://github.com/xach/vectometry.git
$ ln -s vectometry/vectometry.asd vectometry.asd
$ git clone https://github.com/xach/geometry.git
$ ln -s geometry/geometry.asd geometry.asd
$ git clone https://github.com/Wukix/vecto.git
$ ln -s vecto/vecto.asd vecto.asd
$ git clone https://github.com/xach/zpb-ttf.git
$ ln -s zpb-ttf/zpb-ttf.asd zpb-ttf.asd
$ git clone https://github.com/xach/zpng.git
$ ln -s zpng/zpng.asd zpng.asd
$ git clone https://github.com/xach/salza2.git
$ ln -s salza2/salza2.asd salza2.asd
$ git clone https://github.com/fjolliton/cl-vectors.git
$ ln -s cl-vectors/cl-vectors.asd cl-vectors.asd
$ ln -s cl-vectors/cl-paths.asd cl-paths.asd
$ ln -s cl-vectors/cl-aa.asd cl-aa.asd```
Once everything is installed/linked go to the imported project and run:
```bash
mocl --android LispContacts app.lisp

Make sure you have the Android 17 sdk, because that’s what’s used in the example project.

After all of that, cd LispContacts/jni

then run: ndk-build

At this point the code has compiled and you’re good to go. You may have to close ADK and reopen it to get ADK to see the mocl files. I might do another post on the code in the example… Give me a comment if that’s something you’re interested in.