Tue Feb 26 21:39:43 CET 2013
Hi David & others,
I intend to solve this by making it possible to provide extra command
line arguments to erl when Erlang is started from SL4A. Unfortunately I
cannot set this from SL4A, unless I modify SL4A, which I would very much
like to avoid. So, I have to set the command line arguments from the
Erlang installer. This means however, that all started shells will be
started with the same command line arguments. So, either all start with
distribution, or without, unless you change the command line arguments
between two starts. I have tried this, and I can start a shell with
arguments "-sname x -setcookie ssssssss" (no need for a cookie file this
Would this be an acceptable solution for you?
On 02/25/2013 11:36 PM, Juhász Dávid wrote:
> thanks for the quick reply!
> 2013/2/25 Erik Reitsma <erlang@REDACTED>:
>> I had not assumed that people would want to use Erlang on Android in
>> distributed mode. However, now that there appears a "market" for this, I
>> will try to get distribution working too. I think that there may be some
>> issues with ownership of the cookie file, and the user id under which Erlang
> The first problem is the cookie file, indeed. I had to create the file
> set privileges to 700 and give it to the user belonging to SL4A
> manually in order to overcome error messages pointing explicitly to
> the cookie file. After that, there is no explicit sign of any error
> (of course, distributed mode doesn't turn on in the background) unless
> one checks the value of net_kernel:start/1, to which I referred in my
> initial mail. However, I was able to reproduce such values in android
> root terminal and even on my laptop when calling net_kernel:start/1
> without running epmd. So I think the problem here is that epmd can't
> be reached by the runtime, and that can't be helped with simply
> starting epmd by the same user on android.
> Hope that it gives you some pointer to solve the problem.
>> I intend to publish a new version as soon as R16B is out (which should be in
>> a few days). I would prefer to try to get distribution working in that
> Of course, that would be fine. Thanks for your work!
> Best regards,
>> I have also worked a bit on a new installer, which makes it possible to
>> install the small version first, and add libraries later.
>> On 02/25/2013 12:45 PM, Dávid Juhász wrote:
>> Hi Erik and all,
>> The work that has been done is awesome and I am happy to be able to run
>> Erlang code on Android devices!
>> Unfortunately, I ran into a technical problem trying to run distributed
>> Erlang programs on Android via SL4A. In root terminal, distributed mode
>> works smoothly, but in that case I am unable to create GUI for the program.
>> On the other hand, programs started via the scripting layer are running
>> without root privileges which causes some trouble.
>> It seems unavoidable that distributed mode must be initialized
>> programatically using net_kernel:start/1 as SL4A doesn't start Erlang in
>> distributed mode. The first problem I encountered was the insufficient
>> privilege to create a cookie file. Having one created manually, that part of
>> initialization seems to be successful. The next problem seems to be that
>> epmd isn't getting started. I can start epmd in daemon mode from the Erlang
>> program using os:cmd/1, so the program and epmd run under the same user. But
>> the same issue appears:
>> Can someone give me any pointer how to overcome this issue of using GUI and
>> distributed mode at the same time?
>> Thanks in advance for any help!
>> Best wishes,
>> 2013. január 13., vasárnap 21:06:06 UTC+1 időpontban Erik Reitsma a
>> következőt írta:
>>> Hi all,
>>> I have put my port of Erlang to Android on Google Code:
>>> To install it on your Android device, you should allow applications from
>>> unknown sources, because the app is not delivered through Google Play (yet).
>>> The Android device does *not* have to be rooted.
>>> It depends on Scripting Layer for Android (SL4A). So in order to use it,
>>> you should first install SL4A r6 from here:
>>> Then install the APK for Erlang, this one:
>>> This app is just the installer. Run it to actually install Erlang/OTP. I
>>> have included as much of OTP as might be remotely useful, so the download is
>>> 36.5 MB. Of course you want to use the megaco and orber applications on your
>>> You can use the SL4A API through the module android that I have added. I
>>> have added a very simple example, to show you how you can make a small gui
>>> and respond to events. Study the SL4A API to do other Android things.
>>> You can run some Erlang code by putting your source in the SL4A scripts
>>> directory on the Android device, which is /sdcard/sl4a/scripts/. The .erl
>>> file should contain and export a function main/0, which will be called when
>>> the script is run. The .erl file will be compiled to a .beam file
>>> automatically, only if the .beam file does not exist. A minor inconvenience
>>> now is, that if the .erl file is modified, it will not be recompiled unless
>>> the .beam file is removed. The scripts directory will be in the code path,
>>> so if you put other .beam files there, they will be found, and .erl files
>>> there will be compiled too, if necessary.
More information about the erlang-questions