I recently added the Camera and File plugins to my Ionic 1.3/ Cordova app, and now the app is intermittently crashing on the Android device I am using.
The crash is not happening when I am actually using the plugins, nonetheless I wanted to see if the problem would go away if I used more up to date plugins.
If I remove the Camera plugin and add it again, I can see this in the output window:
Warning: Unmet project requirements for latest version of cordova-plugin-camera: Warning: cordova-android (5.2.1 in project,
=6.3.0 required) Warning: Fetching highest version of cordova-plugin-camera that this project supports: 2.4.1 (latest is 4.0.2)
Currently in Visual Studio 2017 you can specify a Toolset that uses Cordova 6.3.1 or a Global Cordova version, so I thought I would try using the latest version of Cordova and on a command line entered: npm install -g cordova
. I had to restart my computer, but now in my config.xml I can choose "Global Cordova 8.0.0".
Now, in order to use the latest Camera plugin I need to get the cordova-android
platform >=6.3.0
. But if I use cordova platform add android
, it fails because that command needs to be run inside a Cordova-based project.
So I navigate to my existing project folder and run cordova platform add android
again. It tries to fetch cordova-android@5.2.1
- so I guess it's now using cordova 6.3.1, because that's the local version. <edit>
Wrong! - cordova -v
tells me it's 8.0.0, so it must be choosing 5.2.0
for some other reason.</edit>
So what do I need to do now? Do I need to uninstall the local cordova from a command line? Do I delete the existing node_modules, platforms, plugins folders? Do I change the config.xml? (current example entry: - <plugin name="cordova-plugin-camera" spec="~2.4.1" />
. If I do all that then decide I need to go back to using Visual Studio's toolset, will I have to keep copies of everything and install manually or can I just go back and select the 6.3.1 toolset again?