Can not start Ionic 4 beta project on Android, export cordova was not found

Hi, I’m trying to migrate my Ionic 3 project into Ionic 4 beta and have runned on a problem with cordova not being able to be exported correctly.

This is my package.json dependencies:

“dependencies”: {
@angular/common”: “6.0.9”,
@angular/core”: “6.0.9”,
@angular/forms”: “6.0.9”,
@angular/http”: “6.0.9”,
@angular/platform-browser”: “6.0.9”,
@angular/platform-browser-dynamic”: “6.0.9”,
@angular/router”: “6.0.9”,
@ionic-native/barcode-scanner”: “^4.10.1”,
@ionic-native/core”: “^4.10.1”,
@ionic-native/facebook”: “^4.10.1”,
@ionic-native/geolocation”: “^4.10.1”,
@ionic-native/google-maps”: “^4.9.1”,
@ionic-native/social-sharing”: “^4.10.1”,
@ionic-native/splash-screen”: “5.0.0-beta.14”,
@ionic-native/status-bar”: “5.0.0-beta.14”,
@ionic/angular”: “4.0.0-beta.0”,
@ionic/ng-toolkit”: “1.0.0”,
@ionic/schematics-angular”: “1.0.0”,
@ionic/storage”: “^2.1.3”,
“cordova-android”: “6.3.0”,
“cordova-plugin-device”: “^2.0.2”,
“cordova-plugin-facebook4”: “^2.2.0”,
“cordova-plugin-geolocation”: “^4.0.1”,
“cordova-plugin-googlemaps”: “^2.3.8”,
“cordova-plugin-ionic-keyboard”: “^2.1.2”,
“cordova-plugin-ionic-webview”: “^2.0.1”,
“cordova-plugin-nativestorage”: “^2.3.2”,
“cordova-plugin-splashscreen”: “^5.0.2”,
“cordova-plugin-whitelist”: “^1.3.3”,
“cordova-plugin-x-socialsharing”: “^5.4.1”,
“cordova-sqlite-storage”: “^2.3.3”,
“core-js”: “^2.5.3”,
“crypto-js”: “^3.1.9-1”,
“es6-promise-plugin”: “^4.2.2”,
“minimist”: “^1.2.0”,
“phonegap-plugin-barcodescanner”: “^8.0.0”,
“rxjs”: “6.2.2”,
“rxjs-compat”: “^6.2.2”,
“xml2js”: “^0.4.19”,
“zone.js”: “^0.8.26”
},

And this is my Ionic Info:

Ionic:

ionic (Ionic CLI) : 4.0.0 (C:\Users\Sam\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.0
@angular-devkit/core : 0.7.0-rc.3
@angular-devkit/schematics : 0.7.0-rc.3
@angular/cli : 6.0.8
@ionic/ng-toolkit : 1.0.0
@ionic/schematics-angular : 1.0.0

Cordova:

cordova (Cordova CLI) : 7.1.0
Cordova Platforms : android 6.3.0

System:

NodeJS : v8.11.2 (C:\Program Files\nodejs\node.exe)
npm : 5.6.0
OS : Windows 10

And this is a list of warnings I’m getting while running ionic serve, the application works on my computer, but I guess the warnings have something to do with it.

> client?719c:148 [WDS] Warnings while compiling.
> client?719c:154 ./node_modules/@ionic-native/splash-screen/ngx/index.js
> 24:55-62 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 24:74-81 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/splash-screen/ngx/index.js
> 25:55-62 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 25:60-67 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 26:65-72 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 27:69-76 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 28:64-71 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 29:78-85 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 30:83-90 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 31:52-59 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 32:52-59 "export 'cordova' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 34:34-52 "export 'cordovaPropertyGet' was not found in '@ionic-native/core'
> client?719c:154 ./node_modules/@ionic-native/status-bar/ngx/index.js
> 35:32-50 "export 'cordovaPropertySet' was not found in '@ionic-native/core'

And at last running ionic cordova run android --device produce a functional build and the app being launched on my phone but only results in a frozen white screen. And this is the output it gives me through the console:

runtime.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
cordova.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
vendor.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
main.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
styles.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
polyfills.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
/assets/icon/favicon.png:1 Failed to load resource: net::ERR_FILE_NOT_FOUND

Anyone else got the same type of error while migrating to Ionic 4 beta?

a good start I think would be to fix your mix of ol and new wrapper and only use 5.0.0-beta.14 for native

Make sense, everything went fine to move up to the 5.0.0-beta.14 besides of google-maps. I can’t even find it in the documentation page https://beta.ionicframework.com/docs/native/ so is it not longer supported? I can’t even run ionic serve any more since google-maps plugin gives me this error:

index.js:91 Uncaught TypeError: Object(...) is not a function
    at index.js:91
    at Object../node_modules/@ionic-native/google-maps/index.js (index.js:121)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/app.module.ts (app.component.ts:12)
    at __webpack_require__ (bootstrap:81)
    at Object../src/main.ts (environment.ts:15)
    at __webpack_require__ (bootstrap:81)
    at Object.0 (main.ts:12)
    at __webpack_require__ (bootstrap:81)
    at checkDeferredModules (bootstrap:43)index.js:91 Uncaught TypeError: Object(...) is not a function
    at index.js:91
    at Object../node_modules/@ionic-native/google-maps/index.js (index.js:121)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/app.module.ts (app.component.ts:12)
    at __webpack_require__ (bootstrap:81)
    at Object../src/main.ts (environment.ts:15)
    at __webpack_require__ (bootstrap:81)
    at Object.0 (main.ts:12)
    at __webpack_require__ (bootstrap:81)
    at checkDeferredModules (bootstrap:43)

That’s not related to Ionic v4, the author of the google maps plugin didn’t wanted to have the wrapper listed in ionic-native something like that. You could find topics about that in other threads of the forum

Maps is a special snowflake and has its own repo for documentation:

I don’t know of its status regarding the new beta of Ionic Native etc. @LoLStats maybe?


Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins · ionic.zone

(I would do that to the working Ionic v3 project, then start the upgrade to v4)