Search code examples
javascriptnode.jscordovacordova-plugins

cordova app stopped working after node and/or cordova update


I recently updated node.js and installed the latest version of cordova at the same time. In doing so I have some issues that I did not have before.

  • It says phonegap.js is depreciated and I need to replace it with cordova.js or plugins may not load
  • whitelist plugin warnings have started showing up:"No Content-Security-Policy meta tag found. Please add one when using the Cordova-plugin-whitelist plugin."
  • My plugins aren't loading on start up, but do on resuming.

The plugins is the only real issue, but I just wanted to list everything encase it gave a clue as to a solution. I have been trying for over a week to fix the plugins issue with no success. I can't just revert to the previous version as I don't know what it was.

Any ideas on possible solutions or suggestions as to what version I was likely to be using in order to have these issues now?


Solution

  • @Marty,
    this is a common problem. You need to set your compiler to build version 3.7.0 or earlier. If you do not set the version when you build, you will get the latest version, and you get the issues you see. You can set this version on the command line when building an App from scratch.

    You need to do the same with your plugins. You need to set the version with them also.

    Since you are doing all this work, you may want to start adding the white-list plugin. It will be required after 4.0.0 to use the web.

    In addition, you will want to start a move to NPM as the source of your plugins.

    This FAQ will help
    Top Mistakes by Developers new to Cordova/Phonegap
    Read

    • #6 - Not setting the "phonegap version" for your compiler
    • #7 - Not setting "version" for you plugins
    • #10 - Not adding the new "white-list" and "white-list plugin" parameters in config.xml.
    • #11 - You need to get your plugins from NPM now.