Running elixir on my Android tablet
As the Mrs. does not allow me to take the laptop on vacation, but we do take the tablet with us, I decided to find out whether Elixir runs on an Android tablet.
I experimented for about an hour or so, and apparently it is quite easy. Here is my proof:
#elixir on android, now all I need is a REPL! #DirtyHackButItWorks #SL4A #Erlang4Android -pa /elixir/lib/elixir/ebin pic.twitter.com/cAN2Ez4UQb
— Tom Janssens (@ToJans) June 25, 2013
How do you do this
With a lot of unicorns and fairydust… No, actually it is quite simple….
Please note that all these steps should be performed on the tablet
- Make sure your tablet is allowed to install non-verified packages/apk’s (Under
settings
/security
,allow unknown sources
- I am not sure about the naming, as my tablet is in Dutch.) - Install ScriptingLayer4Android/SL4A by downloading it from here. I used release 6.
- Install Erlang4Android R16B - download here.
- Download the Elixir precompiled package and unzip it on your device. I used
v0.9.3 and unzipped into
/mnt/sdcard/elixir
- Fire up
Erlang4Android
, installErlang
, and click on the 3 squares on the top right, choosesettings
. Enter-pa /mnt/sdcard/elixir/lib/elixir/ebin
as a parameter, so your erlang scripting environment will auto-load the elixir lib. - Close
Erlang4Android
, open upSL4A
, and click the menu on the bottom,view
, and then chooseinterpreters
- Click on the
Erlang
interpreter, it should fire up an erlang interactive console. - Type the following code:
elixir:eval("IO.puts 'blah'",[]).
and press return
.
For non-erlangers: to quit, type
q().
and pressreturn
.
Todo
While this works, it is by no means workable; I tried using elixir:start_cli().
but that does not work as it closes down the
Erlang shell and ‘SL4A’ assumes it can close the scripting environment. It might be easy to setup a quick REPL script, but the
proper way to do this, would be building a script package.