So I've started looking into React Native, as mobile development is still a very hot topic, and I would like to do x-plat mobile development that provides a native experience, but doesn't suck for the developer (I'm looking at you Xamarin). I'm a big fan of React, and doing mobile dev that allows hot-reloading during the dev cycle sounds too good to be true.
I'm also going to be building this app with my son, who is 6. It is going to be for him to track his jobs (chores) and income (pocket money), and track savings and goals - encouraging some financial literacy and hopefully letting him reason about the money he makes and what he can do with it! I'm hoping JSX and Javascript will make for a clean and clear way to teach some of the concepts we will use for building the app. Even running through the boilerplate, it was quite simple to explain to him that a <Text>
element in the JSX made the app display some text for us. A good start!
If you follow along the Getting Started guide, paying particular attention to the Building Projects with Native Code tab, most of it is pretty straight forward. I'm going to call out some gotchas that I ran across when going through the getting started routine.
One obvious-but-not-obvious gotcha of react native (or any x-plat mobile development) is that if you want to target iOS, you need a mac build machine. So I'm going to be skirting that and starting with android initially.
When you hit Starting The Android Virtual Device, what I ran into was Android Studio demanding I turn off Hyper-V. This is due to it wanting, like most virtualization mechanisms, to act as a hypervisor. I have Hyper-V enabled as I use Docker for Windows, and Docker for Windows uses a Hyper-V VM named MobyLinuxVM
to facilitate the various Docker functionalities from Windows. I didn't particularly want to move away from using Docker for Windows, so I went looking for another way to get the emulator working.
Enter the Visual Studio Emulator for Android. This emulator is "Hyper-V compatible", meaning it happily sits side-by-side with Hyper-V. Install this guy, and once installed run it up. You'll need to use it to download an API Level 23
profile, the same as you would have done for the Android Studio emulator - I went with the 5.2" Marshmallow (6.0.0) XXHDPI Phone API Level 23 (Marshmallow, 6.0.0) 1GB
.
Right, with the emulator sorted and running, it was time to move onto Testing Our Installation. This is where I ran into another problem. It gets to BUILD SUCCESSFUL
, but then fails when attempting to invoke adb.exe
. The solution to this was to add C:\Users\andre\AppData\Local\Android\sdk\platform-tools
to my Path environmental variable.
And with that sorted, Success!
Nice. Coincidentally, I am trying to make a similar app for my son where he can earn "virtual" money and exchange that for real money. Mine is a web app currently as I'm learning the ropes in React world :-)