Livereloading and testing native functionality

I’m pretty new to Ionic and Capacitor, so please forgive me if this is known stuff. I’ve googled but I haven’t been able to find any information.

I’ve successfully been able to build my React apps into Native apps by following the simple instructions here, however I can’t find any information about live-reloading the application in Android Studio.

At the moment if I run npx cap open android, I’m then unable to also run npm run start in my react App. I get the following error:

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/leonardo/Desktop/Node Projects/time-management/public/favicon.ico'

This means that any time I want to see the changes on my device I need to build my app, run npx cap copy, then switch to Android Studio and restart the app from there.

Is there a cleaner workflow for this? This isn’t a problem for things that can be debugged in the web-view, but for testing and debugging native functionality it means a whole lot of stopping and starting while switching between terminal windows.

Let me know if I’m doing something wrong or I’ve missed a part of the workflow.

I get the following error:

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/leonardo/Desktop/Node Projects/time-management/public/favicon.ico'

Are you on Linux? You may need to increase the amount of inotify watchers.

As for livereload you should be able to simply run this command;

ionic capacitor run android --livereload --external

For more details look at the command help

ionic capacitor run --help

I am on Linux, that solved it, thank you!

Also, I’m currently running Capacitor with npx cap run, I installed it following this guide. Do the two versions work the same? Can I use ionic capacitor with my create-react-app app?

Oh, I thought you created the project with the Ionic CLI. It’s slightly easier with the Ionic CLI but you can do the same with Capacitor directly. In fact I published a video a while ago showing how to do livereload on Android.

It worked! Thank you so much!