I've been dealing with a problem lately that has my head crazy (since the project is for a final project, worth the redundancy).
The problem is that every time I'm going to compile the app for android (for now I will not use ios) either with ionic cordova run android or ionic cordova platform add android, not all the plugins are installed, I tried everything, the I have reinstalled and installed all again, the same thing happens, try other projects and they work well. Remove android from platform and I added it again, the same thing is still happening.
This is what appears on the console (during the ionic cordova add platform android and ionic cordova run android):
Using cordova-fetch for cordova-android@~7.0.0
Adding android project…
Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.ionic.starter
Name: Enjoy_Shopping
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Android Studio project detected
Android Studio project detected
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.
Subproject Path: CordovaLib
Subproject Path: app
Installing “cordova-plugin-device” for android
Installing “cordova-plugin-http” for android
Plugin dependency “[email protected]” 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!
“C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\app\src\main\java\com\github\kevinsawicki\http\HttpRequest.java” already exists!
at copyNewFile (C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\lib\pluginHandlers.js:261:45) at install (C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\lib\pluginHandlers.js:51:17)
at ActionStack.process (C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\node_modules\cordova-common\src\ActionStack.js:56:25)
at PluginManager.doOperation (C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:114:20)
at PluginManager.addPlugin (C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:144:17)
at C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\Api.js:247:74
at _fulfilled (C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\cordova\node_modules\q\q.js:570:49
(node:314596) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Uh oh!
“C:\Users\JulioD07\Desktop\TESIS\tesisFrontend\platforms\android\app\src\main\java\com\github\kevinsawicki\http\HttpRequest.java” already exists!
(node:314596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ionic cordova resources android --force
√ Collecting resource configuration and source images - done!
√ Filtering out image resources that do not need regeneration - done!
√ Uploading source images to prepare for transformations - done!
√ Generating platform resources: 18 / 18 complete - done!
√ Modifying config.xml to add new image resources - done!
So, not all the plugins are installed, it's more, they do not even appear at least trying to install, here is a list of the plugins I have installed:
cordova-plugin-advanced-http 1.11.1 "Advanced HTTP plugin"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-http 1.2.0 "SSL Pinning"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.0.2 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 2.3.3 "Cordova sqlite storage plugin"
A sample of what the android.json has:
{
“prepare_queue”: {
“installed”: [],
“uninstalled”: []
},
“config_munge”: {
“files”: {}
},
“installed_plugins”: {
“cordova-plugin-advanced-http”: {
“PACKAGE_NAME”: “io.ionic.starter”
},
“cordova-plugin-device”: {
“PACKAGE_NAME”: “io.ionic.starter”
}
},
“dependent_plugins”: {
“cordova-plugin-file”: {
“PACKAGE_NAME”: “io.ionic.starter”
}
}
}
As you can see, 3 plugins appear, and those are the only ones that appear when you open the project in the Android Studio.
This is the fetch.json file: Which contains all the plugins that will be added to the platform (the android.json appears with them when one makes the ionic cordova platform add android)
{
“cordova-plugin-device”: {
“source”: {
“type”: “registry”,
“id”: “[email protected]”
},
“is_top_level”: true,
“variables”: {}
},
“cordova-plugin-file”: {
“source”: {
“type”: “registry”,
“id”: “cordova-plugin-file@>=2.0.0”
},
“is_top_level”: false,
“variables”: {}
},
“cordova-plugin-advanced-http”: {
“source”: {
“type”: “registry”,
“id”: “cordova-plugin-advanced-http”
},
“is_top_level”: true,
“variables”: {}
},
“cordova-plugin-http”: {
“source”: {
“type”: “registry”,
“id”: “cordova-plugin-http”
},
“is_top_level”: true,
“variables”: {}
},
“cordova-plugin-ionic-keyboard”: {
“source”: {
“type”: “registry”,
“id”: “cordova-plugin-ionic-keyboard”
},
“is_top_level”: true,
“variables”: {}
},
“cordova-plugin-ionic-webview”: {
“source”: {
“type”: “registry”,
“id”: “[email protected]”
},
“is_top_level”: true,
“variables”: {}
},
“cordova-plugin-network-information”: {
“source”: {
“type”: “registry”,
“id”: “cordova-plugin-network-information”
},
“is_top_level”: true,
“variables”: {}
},
“cordova-plugin-splashscreen”: {
“source”: {
“type”: “registry”,
“id”: “[email protected]”
},
“is_top_level”: true,
“variables”: {}
},
“cordova-plugin-whitelist”: {
“source”: {
“type”: “registry”,
“id”: “[email protected]”
},
“is_top_level”: true,
“variables”: {}
},
“cordova-sqlite-storage”: {
“source”: {
“type”: “registry”,
“id”: “cordova-sqlite-storage”
},
“is_top_level”: true,
“variables”: {}
}
}
Info about ionic:
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.9
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.9.4
npm : 5.6.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Users\JulioD07\Desktop\sdk
Misc:
backend : pro