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.
Hey, I’ve tried everything, renaming manually everywhere, renaming the class.
I was actually using ionic so another layer to check :)
Did not think of re-adding the platform.
So thanks a bunch, this worked like a charm.
Thanks Vlad. Took a little digging to figure that out, so it was good to share the information.
Exactly what I needed. Thank you!
dito!
Thanks bro. You saved my day.. :)
Thanks, it working….
This saves me a lot of trouble. Thanks a lot!
I have searched for days trying to find an answer for how to do this simple task. I can’t believe how hard Android Studio makes something that should be so simple. Believe me when I say that I have tried every solution on stack overflow. Your post, though sparce, gave me enough information to figure this out. I never write comments, but want to THANK YOU for this.
Now, if only I could figure out how to use the splash screen cordova android plug-in I’d be all set. More days of searching and trying things out. -Rachel