Suddenly all of my Ionic apps started crashing. This is the error I got.
If chrome is not present or disabled than your ionic app might crash on launch. This rules only applies on debug builds of your app. Continue reading if you want to know how I figured it out.
There might be better way to deal with native apps. I am no expert in Native mobile development. That’s why I chose Ionic a hybrid mobile framework. I hold the views that I am about to share
- Diagnosing Attempt 1
- Quick Solution
- Debugging Attempt 2
May be there is a bug. Lets debug it.
1. Debugging Ionic App: Attempt 1
Ionic app runs in webview so they can be debugged in browser like Google Chrome.
But how can you debug the one that would crash on launch, that would crash immediately.
Android SDK comes with the tool called ADB (Android Debug Bridge). It is a versatile command-line tool that lets you communicate with a device. We can get the device logs using this command
commands goes here with appropriate flag only to log the necessary information
The above screen logs everything. If you interact with your device, this log updates. I thought system will throw some kind of error hencce my app crashes.
So I launched the app, searched terminal with the keyword com.app.appName but of no help. I was not able to find anything meaningful ☹️.
Hence Debugging Ionic App: Attempt #1 failed.
2. Quick Solution
Number one thing that I can do is to rebuild the App. I cleaned up the environment by uninstalling and reinstalling the node_modules. Removing and adding the Android Platform. But nothing helped.
I was desperate to run some of my apps at all cost. Luckily Ionic apps are prepackaged with PWA (Progressive Web Apps). So I turned my Ionic App into to PWA and hosted on heroku.
So I was able to bring my ionic app back online in quick succession.
But we are yet to discover what is causing those crashes
3. Debugging Ionic App: Attempt #2
I downloaded a sworkit (a health fitness an Ionic app) from google play to see whether release app works or not. It was working fine. The problem was with debug apk’s . Debug Build for some reason required Google Chrome browser to be installed on my mobile.
When I checked the chrome browser was disabled. After enabling all of my Ionic Debug Version started working again.
Debugging Ionic App: Attempt #2 worked ?
It was nightmare for me the last couple of weeks. Ryan Holiday books says it all
Obstacle is the way
I did learned a lot from this stretch. This forced to convert my Ionic app to Progressive web app and host it on Heroku. Which by self is a learning experience.
Hope fully you have found a thing or two from this article. Do share your experience if you have been in such weird situation.