cordova build failed after adding a new plugin

Nothing interrupts your productivity like a random Build Failed from the CLI. If your build is failing after you recently added a new plugin and especially if you are getting a CpResource error here is the solution for iOS and Xcode:

  • Open the Xcode project
  • Click on the App name in the sidebar.
  • Click the Build Phases tab.
  • Open the Copy Bundle Resources section.
  • Any missing resources will show up in red. You need to add them manually.

For instance, I recently added the cordova dialogs plugin to my iOS project. The build failed with the CpResource error and CDVNotification.bundle was the missing resource. I was able to locate the bundle in the root project folder – plugins – org.apache.cordova.dialogs – src – ios.