Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 4 Android Application fails to load the source on build

I have an Application build with Ionic 4. When I use to build and install the Application with reload option it works (ionic cordova run android --l --c ). But when I do ionic cordova build android and deploying in a device, it does not load anything and results in blank screen. On inspecting, the following error got printed.

polyfills.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
styles.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
main.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
runtime.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

Researched through and added delay in config.xml file <preference name="loadUrlTimeoutValue" value="700000" /> but that didn't worked. Also removed and add android, still no luck.

If I connect the device to machine and running the application directly to the device with reload command, it is throwing the error The connection to the server was unsuccessful.

Ionic version - 4.10.3; Ionic-Android version - android 6.3.0; Cordova - 7.1.0

like image 390
Joseph Avatar asked Feb 21 '19 10:02

Joseph


Video Answer


1 Answers

Try this Ionic Cordova platform remove Android

Then

  1. Ionic cordova platform add android
  2. Ionic cordova prepare android
  3. Ionic cordova build android
  4. Ionic cordova run android

    If u want to use emulator then use

    Ionic cordova run android -l

like image 113
Himanshu Avatar answered Nov 14 '22 06:11

Himanshu