Cross-platform mobile development on Linux
I have always heard about cross-platform mobile development frameworks(React-native & flutter), and how they make it trivial to maintain a single code base for your application. But how true of a statement is it when it comes to someone on Linux wishing to develop an application with some native networking features?
It is true to some extent:
Two years ago I was working on my thesis and it involved creating a simple mobile application to act as a client for an ML prediction model, on that project I didn’t need any native support and it was only a prototype, which meant I only build it on android. so theoretically I could have built it for ios using any cloud service since you need an Apple machine to build it.
But now I would need to make a development build so often to test my application on both platforms and even write some native code( swift & kotlin ) to wrap it all together. But how to achieve that one Linux only?
Virtualization is always a solution:
The first thing that came to mind was using a traditional commercial Virtual Machine Monitor like Virtual Box, or VM Ware but soon enough I found out after some degging that to use MacOs using them you had to edit the virtual machine config files manually and also to format a virtual disk using the cli since MacOs won’t accept using a regular virtual disk. I followed the docs and some tutorials but I couldn’t manage to get it running.
Then a tool named quickemu came to the rescue. It is a wrapper around qemu that makes creating a Virtual machine using qemu trivial, it auto-downloads the images for you, generates the config files, and creates and mounts the virtual disk into place. Just by following the docs on their github, you could get a MacOS Ventura VM running in no time and without any hustle.
React-Native on Quickemu:
After you are done with the installation. Now comes the development environment set-up. Head to Download Xcode which is Apple’s answer to Android Studio and the android-sdk. after some testing I found out that a specific Xcode version is needed to work with MacOs Ventura which is Xcode 14.3.1.
Some More set-up is still needed till we can build a react-native application on our local machine, you must install cocoapod, the latest version of Ruby, and node@18. I recommend using the HomeBrew package manager to get the latest version of the mentioned tools.
Now The Development:
Now you should be able to build React-native using the react-native cli by just following the toturail on their official docs. But if you are using expo tooling there is one thing that must be kept in mind, which is adding the static linkage in the Pod file. This can be done by adding the following line to the Pod file.