Cordova.js not injected in the app

I’ve an ionic app in which I’ve used these plugins:
Output of ionic cordova plugin ls

call-number 0.0.2 "Cordova Call Number Plugin"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-mauron85-background-geolocation 2.3.5 "CDVBackgroundGeolocation"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

Problem is even after building an apk and running it directly on device, I’m getting this error:

Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

This is happening for all plugins. I tried building apk with the following commands:

  1. ionic cordova build android
  2. ionic cordova build android --prod

Output of ionic info:

cli packages: (/home/akshat/Desktop/logic-square/userApp/node_modules)

    @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.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.11.3
    npm               : 5.6.0 
    OS                : Linux 4.15

Environment Variables:

    ANDROID_HOME : /home/akshat/Android/Sdk

Misc:

    backend : pro

I’ve also tried reinstalling ionic, cordova, android studio, gradle but no luck.
Please help, thanks.

1 Like