Ionic 4: run android scripts not found

Hi,

I get the following results with an app I worked in aswell as with a new app created with “ion start deploytest sidemenu --type=android”.

I’m trying to run the app with “ionic cordova run android --device” on an android phone. The app gets deployed to the phone and starts but after the splashscreen the screen stays white because none of the scripts can be found.

This is the console output I got while deploying the fresh app:

$ ionic cordova run android --device
√ Creating .\www directory for you - done!
> cordova platform add android --save
Using cordova-fetch for cordova-android@~6.3.0
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: io.ionic.starter
        Name: deploytest
        Activity: MainActivity
        Android target: android-26
Subproject Path: CordovaLib
Android project created with cordova-android@6.3.0
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project
Installing "cordova-plugin-device" for android
Adding cordova-plugin-device to package.json
Saved plugin info for "cordova-plugin-device" to config.xml
Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project
Installing "cordova-plugin-splashscreen" for android
Adding cordova-plugin-splashscreen to package.json
Saved plugin info for "cordova-plugin-splashscreen" to config.xml
Discovered plugin "cordova-plugin-ionic-webview" in config.xml. Adding it to the project
Installing "cordova-plugin-ionic-webview" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 6.3.0, failed version requirement: >=6.4.0
Skipping 'cordova-plugin-ionic-webview' for android
Adding cordova-plugin-ionic-webview to package.json
Saved plugin info for "cordova-plugin-ionic-webview" to config.xml
Discovered plugin "cordova-plugin-ionic-keyboard" in config.xml. Adding it to the project
Installing "cordova-plugin-ionic-keyboard" for android
Adding cordova-plugin-ionic-keyboard to package.json
Saved plugin info for "cordova-plugin-ionic-keyboard" to config.xml
--save flag or autosave detected
Saving android@~6.3.0 into config.xml file ...
> ng run app:ionic-cordova-build --platform=android

Date: 2018-08-21T13:21:27.552Z
Hash: c2e55d7497c244d74be7
Time: 30822ms
chunk {common} common.js, common.js.map (common) 15.7 kB  [rendered]
chunk {67} 67.js, 67.js.map () 21.4 kB  [rendered]
chunk {cordova} cordova.js, cordova.js.map (cordova) 72.8 kB  [rendered]
chunk {0} 0.js, 0.js.map () 45.6 kB  [rendered]
chunk {1} 1.js, 1.js.map () 43.2 kB  [rendered]
chunk {2} 2.js, 2.js.map () 45.3 kB  [rendered]
chunk {3} 3.js, 3.js.map () 43 kB  [rendered]
chunk {4} 4.js, 4.js.map () 2.43 kB  [rendered]
chunk {5} 5.js, 5.js.map () 2.31 kB  [rendered]
chunk {6} 6.js, 6.js.map () 210 kB  [rendered]
chunk {7} 7.js, 7.js.map () 204 kB  [rendered]
chunk {8} 8.js, 8.js.map () 210 kB  [rendered]
chunk {9} 9.js, 9.js.map () 204 kB  [rendered]
chunk {10} 10.js, 10.js.map () 13.5 kB  [rendered]
chunk {11} 11.js, 11.js.map () 13.3 kB  [rendered]
chunk {12} 12.js, 12.js.map () 13.4 kB  [rendered]
chunk {13} 13.js, 13.js.map () 9.47 kB  [rendered]
chunk {14} 14.js, 14.js.map () 9.33 kB  [rendered]
chunk {15} 15.js, 15.js.map () 9.46 kB  [rendered]
chunk {16} 16.js, 16.js.map () 9.33 kB  [rendered]
chunk {17} 17.js, 17.js.map () 11.4 kB  [rendered]
chunk {18} 18.js, 18.js.map () 11.1 kB  [rendered]
chunk {19} 19.js, 19.js.map () 11.5 kB  [rendered]
chunk {20} 20.js, 20.js.map () 11.2 kB  [rendered]
chunk {21} 21.js, 21.js.map () 6.71 kB  [rendered]
chunk {22} 22.js, 22.js.map () 6.63 kB  [rendered]
chunk {23} 23.js, 23.js.map () 6.71 kB  [rendered]
chunk {24} 24.js, 24.js.map () 6.63 kB  [rendered]
chunk {25} 25.js, 25.js.map () 23.4 kB  [rendered]
chunk {26} 26.js, 26.js.map () 22.7 kB  [rendered]
chunk {27} 27.js, 27.js.map () 23.1 kB  [rendered]
chunk {28} 28.js, 28.js.map () 22.5 kB  [rendered]
chunk {29} 29.js, 29.js.map () 14.1 kB  [rendered]
chunk {30} 30.js, 30.js.map () 14 kB  [rendered]
chunk {31} 31.js, 31.js.map () 9.68 kB  [rendered]
chunk {32} 32.js, 32.js.map () 9.55 kB  [rendered]
chunk {33} 33.js, 33.js.map () 9.39 kB  [rendered]
chunk {34} 34.js, 34.js.map () 9.28 kB  [rendered]
chunk {35} 35.js, 35.js.map () 14.5 kB  [rendered]
chunk {36} 36.js, 36.js.map () 14.2 kB  [rendered]
chunk {37} 37.js, 37.js.map () 14.6 kB  [rendered]
chunk {38} 38.js, 38.js.map () 14.4 kB  [rendered]
chunk {39} 39.js, 39.js.map () 9.76 kB  [rendered]
chunk {40} 40.js, 40.js.map () 9.65 kB  [rendered]
chunk {41} 41.js, 41.js.map () 7.21 kB  [rendered]
chunk {42} 42.js, 42.js.map () 7.05 kB  [rendered]
chunk {43} 43.js, 43.js.map () 36.5 kB  [rendered]
chunk {44} 44.js, 44.js.map () 36.3 kB  [rendered]
chunk {45} 45.js, 45.js.map () 17.4 kB  [rendered]
chunk {46} 46.js, 46.js.map () 16.8 kB  [rendered]
chunk {47} 47.js, 47.js.map () 17.3 kB  [rendered]
chunk {48} 48.js, 48.js.map () 16.7 kB  [rendered]
chunk {49} 49.js, 49.js.map () 5.7 kB  [rendered]
chunk {50} 50.js, 50.js.map () 2.44 kB  [rendered]
chunk {51} 51.js, 51.js.map () 2.41 kB  [rendered]
chunk {52} 52.js, 52.js.map () 12.8 kB  [rendered]
chunk {53} 53.js, 53.js.map () 12.8 kB  [rendered]
chunk {54} 54.js, 54.js.map () 18.4 kB  [rendered]
chunk {55} 55.js, 55.js.map () 18 kB  [rendered]
chunk {56} 56.js, 56.js.map () 18.3 kB  [rendered]
chunk {57} 57.js, 57.js.map () 18 kB  [rendered]
chunk {58} 58.js, 58.js.map () 24.3 kB  [rendered]
chunk {59} 59.js, 59.js.map () 23.1 kB  [rendered]
chunk {60} 60.js, 60.js.map () 24.5 kB  [rendered]
chunk {61} 61.js, 61.js.map () 23.3 kB  [rendered]
chunk {62} 62.js, 62.js.map () 14.2 kB  [rendered]
chunk {63} 63.js, 63.js.map () 14.1 kB  [rendered]
chunk {64} 64.js, 64.js.map () 16.2 kB  [rendered]
chunk {65} 65.js, 65.js.map () 16 kB  [rendered]
chunk {66} 66.js, 66.js.map () 21.8 kB  [rendered]
chunk {68} 68.js, 68.js.map () 21.8 kB  [rendered]
chunk {102} 102.js, 102.js.map () 27.4 kB  [rendered]
chunk {home-home-module} home-home-module.js, home-home-module.js.map (home-home-module) 5.65 kB  [rendered]
chunk {103} 103.js, 103.js.map () 26.1 kB  [rendered]
chunk {list-list-module} list-list-module.js, list-list-module.js.map (list-list-module) 6.7 kB  [rendered]
chunk {69} 69.js, 69.js.map () 21.4 kB  [rendered]
chunk {70} 70.js, 70.js.map () 16.3 kB  [rendered]
chunk {71} 71.js, 71.js.map () 16.3 kB  [rendered]
chunk {72} 72.js, 72.js.map () 2.8 kB  [rendered]
chunk {73} 73.js, 73.js.map () 19.2 kB  [rendered]
chunk {74} 74.js, 74.js.map () 18.7 kB  [rendered]
chunk {75} 75.js, 75.js.map () 2.93 kB  [rendered]
chunk {76} 76.js, 76.js.map () 22.6 kB  [rendered]
chunk {77} 77.js, 77.js.map () 22.2 kB  [rendered]
chunk {78} 78.js, 78.js.map () 24.3 kB  [rendered]
chunk {79} 79.js, 79.js.map () 23.7 kB  [rendered]
chunk {80} 80.js, 80.js.map () 15.7 kB  [rendered]
chunk {81} 81.js, 81.js.map () 15.6 kB  [rendered]
chunk {82} 82.js, 82.js.map () 14.1 kB  [rendered]
chunk {83} 83.js, 83.js.map () 7.3 kB  [rendered]
chunk {84} 84.js, 84.js.map () 7.25 kB  [rendered]
chunk {85} 85.js, 85.js.map () 18.1 kB  [rendered]
chunk {86} 86.js, 86.js.map () 21.1 kB  [rendered]
chunk {87} 87.js, 87.js.map () 19.8 kB  [rendered]
chunk {88} 88.js, 88.js.map () 19.6 kB  [rendered]
chunk {89} 89.js, 89.js.map () 19 kB  [rendered]
chunk {90} 90.js, 90.js.map () 13.6 kB  [rendered]
chunk {91} 91.js, 91.js.map () 13.2 kB  [rendered]
chunk {92} 92.js, 92.js.map () 13 kB  [rendered]
chunk {93} 93.js, 93.js.map () 12.7 kB  [rendered]
chunk {94} 94.js, 94.js.map () 9.05 kB  [rendered]
chunk {95} 95.js, 95.js.map () 1.6 kB  [rendered]
chunk {96} 96.js, 96.js.map () 11.8 kB  [rendered]
chunk {97} 97.js, 97.js.map () 11.4 kB  [rendered]
chunk {98} 98.js, 98.js.map () 11.8 kB  [rendered]
chunk {99} 99.js, 99.js.map () 11.4 kB  [rendered]
chunk {100} 100.js, 100.js.map () 9.69 kB  [rendered]
chunk {101} 101.js, 101.js.map () 9.71 kB  [rendered]
chunk {104} 104.js, 104.js.map () 27.8 kB  [rendered]
chunk {105} 105.js, 105.js.map () 26.7 kB  [rendered]
chunk {106} 106.js, 106.js.map () 6.59 kB  [rendered]
chunk {107} 107.js, 107.js.map () 6.57 kB  [rendered]
chunk {108} 108.js, 108.js.map () 15.7 kB  [rendered]
chunk {109} 109.js, 109.js.map () 15.5 kB  [rendered]
chunk {110} 110.js, 110.js.map () 15.7 kB  [rendered]
chunk {111} 111.js, 111.js.map () 15.5 kB  [rendered]
chunk {112} 112.js, 112.js.map () 16.2 kB  [rendered]
chunk {113} 113.js, 113.js.map () 16 kB  [rendered]
chunk {114} 114.js, 114.js.map () 20.4 kB  [rendered]
chunk {115} 115.js, 115.js.map () 19.9 kB  [rendered]
chunk {116} 116.js, 116.js.map () 19.3 kB  [rendered]
chunk {117} 117.js, 117.js.map () 19 kB  [rendered]
chunk {118} 118.js, 118.js.map () 11.5 kB  [rendered]
chunk {119} 119.js, 119.js.map () 14.7 kB  [rendered]
chunk {120} 120.js, 120.js.map () 1.28 kB  [rendered]
chunk {121} 121.js, 121.js.map () 2.36 kB  [rendered]
chunk {main} main.js, main.js.map (main) 14.2 kB [initial] [rendered]
chunk {122} 122.js, 122.js.map () 1.39 kB  [rendered]
chunk {123} 123.js, 123.js.map () 8.11 kB  [rendered]
chunk {124} 124.js, 124.js.map () 9.87 kB  [rendered]
chunk {125} 125.js, 125.js.map () 4.64 kB  [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 226 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 8.06 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 35.4 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.87 MB [initial] [rendered]
chunk {126} 126.js, 126.js.map () 1.8 kB  [rendered]
chunk {127} 127.js, 127.js.map () 3.92 kB  [rendered]
chunk {128} 128.js, 128.js.map () 6.53 kB  [rendered]
chunk {129} 129.js, 129.js.map () 10.5 kB  [rendered]
chunk {130} 130.js, 130.js.map () 19.4 kB  [rendered]
> cordova run android --device
ANDROID_HOME=C:\Users\JWA\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
Starting a Gradle Daemon (subsequent builds will be faster)
:wrapper

BUILD SUCCESSFUL in 19s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Starting a Gradle Daemon (subsequent builds will be faster)
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_cgn419xn4dkvurf3alfc6xm9h.run(C:\Users\JWA\Documents\Projekte\tests\deploytest\platforms\android\build.gradle:141)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:incrementalDebugJavaCompilationSafeguard
:CordovaLib:compileDebugJavaWithJavac
:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
:CordovaLib:bundleDebug
:prepareOrgApacheCordovaCordovaLib630DebugLibrary
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugResValues
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:incrementalDebugJavaCompilationSafeguard
:compileDebugJavaWithJavac
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:compileDebugNdk UP-TO-DATE
:compileDebugSources
:mergeDebugShaders
:compileDebugShaders
:generateDebugAssets
:mergeDebugAssets
:transformClassesWithDexForDebug
:mergeDebugJniLibFolders
:transformNative_libsWithMergeJniLibsForDebug
:processDebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug
:validateSigningDebug
:packageDebug
:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL

Total time: 54.682 secs
Built the following apk(s):
        C:/Users/JWA/Documents/Projekte/tests/deploytest/platforms/android/build/outputs/apk/android-debug.apk
ANDROID_HOME=C:\Users\JWA\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
Skipping build...
Built the following apk(s):
        C:/Users/JWA/Documents/Projekte/tests/deploytest/platforms/android/build/outputs/apk/android-debug.apk
Using apk: C:/Users/JWA/Documents/Projekte/tests/deploytest/platforms/android/build/outputs/apk/android-debug.apk
Package name: io.ionic.starter
LAUNCH SUCCESS

And the console output from chromes devtools remote device inspection:

runtime.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
polyfills.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
styles.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
/assets/icon/favicon.png:1 Failed to load resource: net::ERR_FILE_NOT_FOUND

And my ionic info:

Ionic:

   ionic (Ionic CLI)          : 4.1.1 (C:\Users\JWA\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.3
   @angular-devkit/core       : 0.7.4
   @angular-devkit/schematics : 0.7.4
   @angular/cli               : 6.1.4
   @ionic/ng-toolkit          : 1.0.7
   @ionic/schematics-angular  : 1.0.5

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : android 6.3.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.3, (and 3 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\JWA\AppData\Local\Android\Sdk)
   NodeJS            : v8.11.3 (C:\Program Files\nodejs\node.exe)
   npm               : 5.10.0
   OS                : Windows 10

The app works in the browser just fine (ionic serve). I found some older threads that described a similar problem, but if they had any solutions they did not work for me.

@jwallmueller tente criar um novo projeto, baixando as dependências necessárias e importando o que você já tem de código, poste resultados.

As stated in my original post I did try this with a new project (ionic start deploytest sidemenu --type=angular) and tried to deploy that with the same results. In fact, the console log in my original post is from that new and untouched project.

I was having the same issue today. Fiddled around a lot…
Finally removing and re-adding android platform fixed the issue for me.

`ionic cordova platform remove android`
`ionic cordova platform add android`

Then try deploying the app.

Hi,

I treid that several times with different cordova-android versions (6.3 and 7.1), unfortunately, it did not work for me.