Everybody seems to have developed a mobile app at least once in his life, so I always thought that mine was just a matter of time. Last week I finally decided to take this next step and I started to look for more information about mobile development.
Around three years ago, I tried to play with the Android SDK and Java, but I found the documentation very confusing and I thought I didn’t have the stoma… I wasn’t mature enough to handle the complexity just using my spare time. From that time to now, I have been hearing a lot about hybrid apps and how useful they can be for small teams and where performance is not a requirement.
I was decided to build my first app using Cordova and, if possible, Clojurescript, and I started to search for related documentation and experiences of other developers. I don’t remember exactly how I ended up reading something about React Native, but it got my attention, since I had some happy experiences with Reagent. In addition, with React Native I would be able to generate a native app (with potential performance issues).
Re-Natal is based on re-frame, which was new to me. I knew about the project before because of their Reagent tutorials I used when I implemented my first reactive web applications, but, as I didn’t want to start by using a framework, I didn’t dig into it. By using Re-Natal, I decided to read the re-frame docs to have an opinion. I got surprised by their functional approach! It was really nice to understand it, I felt like learning more about functional programming in general, not just a framework.
Now I felt ready to start playing with some code and I generated a project using Re-Natal. To install all the required dependencies, I followed a post from gadfly and everything worked almost as expected. I didn’t installed Watchman (since it was supposed to be optional) and I didn’t want to use Genymotion, I preferred to try the Android Virtual Device.
When starting an AVD, selecting the option “use host GPU” makes the emulation much faster and nicer to work with a REPL, but I got an error:
libGL error: unable to load driver ... ...
Setting the environment variable
ANDROID_EMULATOR_USE_SYSTEM_LIBS, as described
in this answer, was enough to
solve the problem.
Another error that happened was a
ENOSPC (not enough space) error. This weird
problem was solved by this answer.
Maybe using Watchman would have avoided this error, but I didn’t tried.
Finally, after just a few tweaks in the generated code, I was able to have my first mobile app! After trying the Java SDK (and feeling stupid for not getting it quickly), this implementation looked so simple, so easy, so… stupidly easy (the final feeling was almost the same, but for different reasons). The result was this simple Android project: Countdown.