Renaming a Cordova application
As my loyal readers know, I’ve been working on my first Cordova application, focusing on Android. Of course I found the Android emulator to be very slow, so I worked solely in a browser for a few days.
When I tried installing on my phone (using Cordova run Android), I had a rude surprise – The app crashed on startup, showing a message before any HTML was visible:
Unfortunately, [Insert App Name Here] has stopped.
Thinking back to what I had done that might affect the configuration or interface layer, I eventually remembered that I had changed the name of the application. I had initially accepted project defaults, so undertook a small rebranding effort.
After a bit more digging and testing, I found that everything that could have broken is pretty much auto-generated from Cordova’s config.xml file when Android support is added to the project. This includes java code bearing your application name, etc.
Rather than pick through that code, I simply removed Android support from the project, and re-added it. Problem solved:
cordova platform remove android cordova platform add android
Takehome point: Dev work in the browser is fine, but test any configuration changes on a phone or *real* emulator.
9 comments