I’m not sure what’s going on here… but I continue to get errors when building and adding platform. I’m on latest version of ionic and have tried downgrading too.
This is the error:
Failed to restore plugin “cordova-plugin-media-capture” from config.xml. You might need to try adding it again. Error: Version of installed plugin: “cordova-plugin-file@5.0.0” does not satisfy dependency plugin requirement “cordova-plugin-file@^4.0.0”. Try --force to use installed plugin as dependency.
In my config.xml and package.json I have these dependencies:
And a bunch of other dependencies that also have dependencies for this. However, when the script comes to install cordova-plugin-file plugin, it grabs version 5.0.0. This isn’t compatible with another plugin I’m using so it throws an error - but why is it fetching version 5.0.0 if I’ve explicitly set 4.3.3?
Another plugin has a dependency for cordova-plugin-file, such as this one:
So my guess is that it’s finding this plugin first, and installing the latest version of cordova-plugin-file - and then fails when it gets to another plugin that is dependant on an earlier version… however, moving the cordova-plugin-file dependency to the top of the config.xml doesn’t seem to help.
$ ionic cordova platform add android@latest
> cordova platform add android@latest --save
Using cordova-fetch for cordova-android@latest
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.test.app
Name: App_Name
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Android project created with cordova-android@6.4.0
Discovered plugin "com-sarriaroman-photoviewer" in config.xml. Adding it to the project
Installing "com-sarriaroman-photoviewer" for android
Subproject Path: CordovaLib
Adding com-sarriaroman-photoviewer to package.json
Saved plugin info for "com-sarriaroman-photoviewer" to config.xml
Discovered plugin "com.synconset.imagepicker" in config.xml. Adding it to the project
Installing "com.synconset.imagepicker" for android
Subproject Path: CordovaLib
Adding com.synconset.imagepicker to package.json
Saved plugin info for "com.synconset.imagepicker" to config.xml
Discovered plugin "cordova-plugin-advanced-http" in config.xml. Adding it to the project
Installing "cordova-plugin-advanced-http" for android
Installing "cordova-plugin-file" for android
The Android Persistent storage location now defaults to "Internal". Please check this plugin's README to see if your application needs any changes in its config.xml.
If this is a new application no changes are required.
If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:
"<preference name="AndroidPersistentFileLocation" value="Compatibility" />"
to config.xml in order for the application to find previously stored files.
Adding cordova-plugin-advanced-http to package.json
Saved plugin info for "cordova-plugin-advanced-http" to config.xml
Discovered plugin "cordova-plugin-android-permissions" in config.xml. Adding it to the project
Installing "cordova-plugin-android-permissions" for android
Adding cordova-plugin-android-permissions to package.json
Saved plugin info for "cordova-plugin-android-permissions" to config.xml
Discovered plugin "cordova-plugin-camera" in config.xml. Adding it to the project
Installing "cordova-plugin-camera" for android
Installing "cordova-plugin-compat" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 6.4.0, failed version requirement:
<6.3.0
Skipping 'cordova-plugin-compat' for android
Subproject Path: CordovaLib
Adding cordova-plugin-camera to package.json
Saved plugin info for "cordova-plugin-camera" to config.xml
Discovered plugin "cordova-plugin-console" in config.xml. Adding it to the project
Installing "cordova-plugin-console" for android
Adding cordova-plugin-console to package.json
Saved plugin info for "cordova-plugin-console" to config.xml
Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project
Installing "cordova-plugin-device" for android
Adding cordova-plugin-device to package.json
Saved plugin info for "cordova-plugin-device" to config.xml
Discovered plugin "cordova-plugin-fcm" in config.xml. Adding it to the project
Installing "cordova-plugin-fcm" for android
Subproject Path: CordovaLib
Cordova FCM plugin v2.1.2 installed
For more details visit https://github.com/fechanique/cordova-plugin-fcm
Adding cordova-plugin-fcm to package.json
Saved plugin info for "cordova-plugin-fcm" to config.xml
Discovered plugin "cordova-plugin-file-transfer" in config.xml. Adding it to the project
Installing "cordova-plugin-file-transfer" for android
Plugin dependency "cordova-plugin-file@5.0.0" already fetched, using that version.
Dependent plugin "cordova-plugin-file" already installed on android.
Adding cordova-plugin-file-transfer to package.json
Saved plugin info for "cordova-plugin-file-transfer" to config.xml
Discovered plugin "cordova-plugin-filechooser" in config.xml. Adding it to the project
Installing "cordova-plugin-filechooser" for android
Adding cordova-plugin-filechooser to package.json
Saved plugin info for "cordova-plugin-filechooser" to config.xml
Discovered plugin "cordova-plugin-filepath" in config.xml. Adding it to the project
Installing "cordova-plugin-filepath" for android
Subproject Path: CordovaLib
Adding cordova-plugin-filepath to package.json
Saved plugin info for "cordova-plugin-filepath" to config.xml
Discovered plugin "cordova-plugin-http" in config.xml. Adding it to the project
Installing "cordova-plugin-http" for android
Plugin dependency "cordova-plugin-file@5.0.0" already fetched, using that version.
Dependent plugin "cordova-plugin-file" already installed on android.
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-http': CordovaError: Uh oh!
"/Users/user/code/apps/test/platforms/android/src/com/github/kevinsawicki/http/HttpRequest.java" already exists!
at copyNewFile (/Users/user/code/apps/test/platforms/android/cordova/lib/pluginHandlers.js:245:45)
at install (/Users/user/code/apps/test/platforms/android/cordova/lib/pluginHandlers.js:43:17)
at ActionStack.process (/Users/user/code/apps/test/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25)
at PluginManager.doOperation (/Users/user/code/apps/test/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114:20)
at PluginManager.addPlugin (/Users/user/code/apps/test/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:144:17)
at /Users/user/code/apps/test/platforms/android/cordova/Api.js:243:74
at _fulfilled (/Users/user/code/apps/test/platforms/android/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/Users/user/code/apps/test/platforms/android/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/Users/user/code/apps/test/platforms/android/cordova/node_modules/q/q.js:816:13)
at /Users/user/code/apps/test/platforms/android/cordova/node_modules/q/q.js:570:49
Failed to restore plugin "cordova-plugin-http" from config.xml. You might need to try adding it again. Error: Uh oh!
"/Users/user/code/apps/test/platforms/android/src/com/github/kevinsawicki/http/HttpRequest.java" already exists!
Discovered plugin "cordova-plugin-inappbrowser" in config.xml. Adding it to the project
Installing "cordova-plugin-inappbrowser" for android
Adding cordova-plugin-inappbrowser to package.json
Saved plugin info for "cordova-plugin-inappbrowser" to config.xml
Discovered plugin "cordova-plugin-media-capture" in config.xml. Adding it to the project
Installing "cordova-plugin-media-capture" for android
Failed to install 'cordova-plugin-media-capture': CordovaError: Version of installed plugin: "cordova-plugin-file@5.0.0" does not satisfy dependency plugin requirement "cordova-plugin-file@^4.0.0". Try --force to use installed plugin as dependency.
at /Users/user/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:557:37
at _fulfilled (/Users/user/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/user/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Users/user/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/q/q.js:749:13)
at /Users/user/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/q/q.js:509:49
at flush (/Users/user/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Failed to restore plugin "cordova-plugin-media-capture" from config.xml. You might need to try adding it again. Error: Version of installed plugin: "cordova-plugin-file@5.0.0" does not satisfy dependency plugin requirement "cordova-plugin-file@^4.0.0". Try --force to use installed plugin as dependency.
Discovered plugin "cordova-plugin-nativestorage" in config.xml. Adding it to the project
Installing "cordova-plugin-nativestorage" for android
Adding cordova-plugin-nativestorage to package.json
Saved plugin info for "cordova-plugin-nativestorage" to config.xml
Discovered plugin "cordova-plugin-network-information" in config.xml. Adding it to the project
Installing "cordova-plugin-network-information" for android
Adding cordova-plugin-network-information to package.json
Saved plugin info for "cordova-plugin-network-information" to config.xml
Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project
Installing "cordova-plugin-splashscreen" for android
Adding cordova-plugin-splashscreen to package.json
Saved plugin info for "cordova-plugin-splashscreen" to config.xml
Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project
Installing "cordova-plugin-statusbar" for android
Adding cordova-plugin-statusbar to package.json
Saved plugin info for "cordova-plugin-statusbar" to config.xml
Discovered plugin "cordova-plugin-themeablebrowser" in config.xml. Adding it to the project
Installing "cordova-plugin-themeablebrowser" for android
Adding cordova-plugin-themeablebrowser to package.json
Saved plugin info for "cordova-plugin-themeablebrowser" to config.xml
Discovered plugin "cordova-plugin-videoplayer" in config.xml. Adding it to the project
Installing "cordova-plugin-videoplayer" for android
Adding cordova-plugin-videoplayer to package.json
Saved plugin info for "cordova-plugin-videoplayer" to config.xml
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
Discovered plugin "cordova-plugin-zip" in config.xml. Adding it to the project
Installing "cordova-plugin-zip" for android
Plugin dependency "cordova-plugin-file@5.0.0" already fetched, using that version.
Dependent plugin "cordova-plugin-file" already installed on android.
Adding cordova-plugin-zip to package.json
Saved plugin info for "cordova-plugin-zip" to config.xml
Discovered plugin "cordova-sqlite-storage" in config.xml. Adding it to the project
Installing "cordova-sqlite-storage" for android
installing external dependencies via npm
npm install of external dependencies ok
Adding cordova-sqlite-storage to package.json
Saved plugin info for "cordova-sqlite-storage" to config.xml
Discovered plugin "cordova.plugins.diagnostic" in config.xml. Adding it to the project
Installing "cordova.plugins.diagnostic" for android
Subproject Path: CordovaLib
Adding cordova.plugins.diagnostic to package.json
Saved plugin info for "cordova.plugins.diagnostic" to config.xml
Discovered plugin "ionic-plugin-keyboard" in config.xml. Adding it to the project
Installing "ionic-plugin-keyboard" for android
Adding ionic-plugin-keyboard to package.json
Saved plugin info for "ionic-plugin-keyboard" to config.xml
--save flag or autosave detected
Saving android@latest into config.xml file ...