Developing an Android app via Ionic can take awhile, especially testing. Using an emulator, for me, is out of the question because it is extremely slow. So, what I’ve done in the past is used my own phone, connecting to the machine via USB. But, it takes at least 10-15 seconds on my set up for Android Studio to build and run the app on my phone.
I knew there must be a way to test on a Desktop. Ionic has a built-in server that you can run to test apps via a web browser. To use it, you can type:
in a terminal window. You need to make sure you are in the root directory of the Ionic app.
Also, another note: one mistake I made using Ionic is that I edited my source in the android/assets/www directory using Android Studio. It turns out, this isn’t a great idea. Whenever you modify something in Ionic, say install a plugin or something, it copies the root www folder into the android www folder, thus overwriting your new code.
It turns out that using Android Studio just isn’t the best way to go to test directly on an Android device. The best way to do this is via the following commands:
ionic build android
ionic run android
I was at first skeptical that Ionic would know how to deploy to my device connected via USB…but, it does.