I’m trying to add platform so that i can build apk file for my app
C:\sudafax> cordova platform add android
Using cordova-fetch for cordova-android@^6.4.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.sudafax.dailynews
Name: ________
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Android project created with cordova-android@6.4.0
config file *-Info.plist requested for changes not found at F:\Ionic\New\sudafax\platforms\android\*-Info.plist, ignoring
config file *-Info.plist requested for changes not found at F:\Ionic\New\sudafax\platforms\android\*-Info.plist, ignoring
Installing "cordova-admob-sdk" for android
Subproject Path: CordovaLib
Installing "cordova-android-play-services-gradle-release" for android
Subproject Path: CordovaLib
Failed to install 'cordova-android-play-services-gradle-release': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
at Context.requireCordovaModule (C:\Users\Codedev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\Context.js:57:15)
at module.exports (F:\Ionic\New\sudafax\plugins\cordova-android-play-services-gradle-release\scripts\apply-changes.js:87:20)
at runScriptViaModuleLoader (C:\Users\Codedev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:181:32)
at runScript (C:\Users\Codedev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:157:16)
at C:\Users\Codedev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:125:20
at process._tickCallback (internal/process/next_tick.js:68:7)
Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
With the ‘Ionic 4’ CLI you still will be able to build/serve or whatever with your Ionic 3 app. The thing is, when building for an platform the CLI is using some up-to-date ‘rules’ to create and/or build a platform project/file. Your ‘project-files’ are outdated and therefor not working anymore when building again. (simply said)
Therefore it looks like you’ll have to update your Ionic and Cordova and maybe make some small adjustments. You can always downgrade your Ionic and Cordova to whatever version you want. If you’re affraid of trying, just backup your Ionic project.
Same error i updated cordova ionic , also did all changes in this post
cordova platform add android
Using cordova-fetch for cordova-android@^8.0.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.sudafax.dailynews
Name: ________
Activity: MainActivity
Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@8.0.0
config file *-Info.plist requested for changes not found at F:\Ionic\New\sudafax\platforms\android\*-Info.plist, ignoring
config file *-Info.plist requested for changes not found at F:\Ionic\New\sudafax\platforms\android\*-Info.plist, ignoring
Installing "cordova-admob-sdk" for android
Subproject Path: CordovaLib
Subproject Path: app
Installing "cordova-android-play-services-gradle-release" for android
Failed to install 'cordova-android-play-services-gradle-release': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
at Context.requireCordovaModule (C:\Users\Codedev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\Context.js:57:15)
at module.exports (F:\Ionic\New\sudafax\plugins\cordova-android-play-services-gradle-release\scripts\apply-changes.js:99:20)
at runScriptViaModuleLoader (C:\Users\Codedev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:181:32)
at runScript (C:\Users\Codedev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:157:16)
at C:\Users\Codedev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:125:20
at process._tickCallback (internal/process/next_tick.js:68:7)
Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
You also did delete the folders platforms/ plugins/ and www/?
By the way, I’ve missed in your error log that you’re using cordova-android-play-services-gradle-release. Delete cordova-android-play-services-gradle-release from your config.xml and package.json
Perform a npm update (updating all packages to ‘wanted’ version) npm update