Running elixir app on Android?


can anyone succeeded to run elixir app on android and integrate it with native UI?

Any hints?

I know how to use JNI, I rather wonder how to bundle interpreter, compiled elixir app and native Java app all together.

1 Like

I don’t think anyone has done that before. However the folks from CouchDB (built with Erlang) did have a version running on iOS / Android, they might help you out better.

Since it’s not easy to do and it’s not common, I’m wondering why you would like to use Elixir on Android specifically?

I’ve seen a video once of a guy who had an OTP 16 or 17 (not sure right now) installed on android, and used the erlang shell to compile elixir by hand, module by module, until he was able to switch over into iex. But AFAIK there was no interaction possible besides simple IO.

It was really only a “look at it, it works!”-demo rather than anything which actually works :wink:

Also I was able to find an ERTS implementation for OTP 17:

You should be able to run Elixir 1.0 or 1.1 on top of it, but it might be a lot of work and I am not sure if you will be able to have any non-terminal interaction.

I have an app that is written in elixir and I do not want to rewrite it
into anything else, first because of costs, secondly it is soft-realtime
thing, that benefits from erlang a lot.

All guarantees you do have from BEAM are not worth a penny when running on a mobile device of any kind. Android as well as iOS do suspend your app on their behalf when they are not in foreground, maybe even when in foreground but the display is locked.

Do not do real time of any kind on a mobile device unless you are willing to have a really soft definition of the “soft” in soft-realtime, or you are willing to dive deep into the system you are programming against. Even then android might still just suspend your app just because…

I know, but in my use case this is unlikely. My app is enabling CPU lock, WiFi lock and disabling all other things in the system that can cause automatic shutdown. It keeps screen on, and user is rather not going to use phone to anything else. Task itself is delegated to Service, etc. I really do what I can to prevent this scenario, and so far with prototype made with other technology bound via JNI it works fine.

These limitations will be present anyway but if I can re-use my elixir app with all good it provides instead of rewriting this into C, I go for it.

1 Like