Cordova not included in included on device app/APK


#1

I’m trying to test my app on an Android device with versions:

cordova@8.0.0
ionic@3.20.0

I’ve set up and built my app APK like so:

ionic cordova platform add android
ionic cordova build android

This builds successfully and I can copy the APK from:

/…/my-app/platforms/android/app/build/outputs/apk/debug/app-debug.apk

to my phone.

But when I use the Chrome inspector on my laptop to remote inspect the app running on my phone, I notice the following warning:

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

Furthermore, when I add a console.log(this.platform._platforms) (usign the PlatformProvider) it prints: ["mobile", "android", "phablet", "mobileweb"]

What could be going on?


#2

OK, figured it out.

For anyone who comes across this with a similar problem, make sure you haven’t accidently deleted <script src="cordova.js"></script> from your index.html (as I did). Without this, it obviously isn’t included in your native builds.