Ionic cordova run android does nothing

im trying to run the command to run my ionic 3 application on the Android emulator by using

ionic cordova run android

however after I run the command, the emulator does not start or anything happens

i just get the following

[18:06:47] lint started … [18:06:47] build dev finished in 10.52 s

cordova run android Android Studio project detected

(node:4268) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The “chunk” argument must be one of type string or Buffer at validChunk (_stream_writable.js:253:10) at Socket.Writable.write (_stream_writable.js:288:21) at Socket.stream.write (C:\Users\pkhon\AppData\Roaming\nvm\v8.4.0\node_modules\cordova\node_modules\ansi\lib\newlines.js:36:21) at Object. (C:\Users\pkhon\WebstormProjects\fcmPractice\myApp\plugins\cordova-plugin-fcm\scripts\fcm_config_files_process.js:80:24) at Module._compile (module.js:660:30) at Object.Module._extensions…js (module.js:671:10) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3) at Module.require (module.js:604:17) (node:4268) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a p romise which was not handled with .catch(). (rejection id: 1) (node:4268) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a no n-zero exit code.

[OK] Your app has been deployed. Did you know you can live-reload changes from your app with --livereload?

[18:06:54] lint finished in 7.32 s

ionic info:

C:\Users\pkhon\WebstormProjects\fcmPractice\myApp>ionic info

cli packages: (C:\Users\pkhon\AppData\Roaming\nvm\v8.4.0\node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

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              : v9.4.0
npm               : 5.3.0
OS                : Windows 10

Environment Variables:

ANDROID_HOME : C:\Users\pkhon\AppData\Local\Android\Sdk

Misc:

backend : legacy

Please post the complete output you are getting when running the command.
Also post the output you get when you run the same command with --verbose added at the end.

The error you see there indicated a problem with the cordova-plugin-fcm plugin. Is this the current version that should work with cordova-android 7.0.0? Did you check its Github issues?

C:\Users\pkhon\WebstormProjects\fcmPractice\myApp>ionic cordova run android

cordova platform add android --save
Using cordova-fetch for cordova-android@~7.0.0

Adding android project…

Creating Cordova project for the Android platform:

    Path: platforms\android
    Package: com.pwh.test
    Name: myApp
    Activity: MainActivity
    Android target: android-26

Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@7.0.0

Android Studio project detected

Android Studio project detected

Installing “cordova-plugin-device” for android

Installing “cordova-plugin-fcm” for android

Subproject Path: CordovaLib
Subproject Path: app

            Cordova FCM plugin v2.1.2 installed
            For more details visit https://github.com/fechanique/cordova-plugin-fcm

Installing “cordova-plugin-ionic-webview” for android

Installing “cordova-plugin-splashscreen” for android

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.

Installing “ionic-plugin-keyboard” for android

–save flag or autosave detected

Saving android@~7.0.0 into config.xml file …

Running app-scripts build: --platform android --target cordova
[21:31:37] build dev started …
[21:31:37] clean started …
[21:31:37] clean finished in 17 ms
[21:31:37] copy started …
[21:31:37] deeplinks started …
[21:31:37] deeplinks finished in 36 ms
[21:31:37] transpile started …
[21:31:42] transpile finished in 4.73 s
[21:31:42] preprocess started …
[21:31:42] preprocess finished in 1 ms
[21:31:42] webpack started …
[21:31:42] copy finished in 5.15 s
[21:31:49] webpack finished in 7.17 s
[21:31:49] sass started …
Without from option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to undefined to prevent this warning.
[21:31:51] sass finished in 1.23 s
[21:31:51] postprocess started …
[21:31:51] postprocess finished in 24 ms
[21:31:51] lint started …
[21:31:51] build dev finished in 13.58 s

cordova run android
Android Studio project detected

(node:4080) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The “chunk” argument must be one of type string or Buffer
at validChunk (_stream_writable.js:253:10)
at Socket.Writable.write (_stream_writable.js:288:21)
at Socket.stream.write (C:\Users\pkhon\AppData\Roaming\nvm\v8.4.0\node_modules\cordova\node_modules\ansi\lib\newlines.js:36:21)
at Object. (C:\Users\pkhon\WebstormProjects\fcmPractice\myApp\plugins\cordova-plugin-fcm\scripts\fcm_config_files_process.js:80:24)
at Module._compile (module.js:660:30)
at Object.Module._extensions…js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
(node:4080) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a p
romise which was not handled with .catch(). (rejection id: 1)
(node:4080) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a no
n-zero exit code.
[21:31:55] lint finished in 4.65 s

[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?

C:\Users\pkhon\WebstormProjects\fcmPractice\myApp>

with verbose

C:\Users\pkhon\WebstormProjects\fcmPractice\myApp>ionic cordova run android --verbose
[DEBUG] Reason for not using local CLI: LOCAL_CLI_NOT_FOUND
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: ‘C:\Users\pkhon\WebstormProjects\fcmPractice\myApp’, local: false, binPath:
‘C:\Users\pkhon\AppData\Roaming\nvm\v8.4.0\node_modules\ionic\bin\ionic’, libPath:
‘C:\Users\pkhon\AppData\Roaming\nvm\v8.4.0\node_modules\ionic\dist\index.js’ }
[DEBUG] Daemon found (pid: 13708)
Running app-scripts build: --platform android --target cordova
[21:35:17] build dev started …
[21:35:17] clean started …
[21:35:17] clean finished in 33 ms
[21:35:17] copy started …
[21:35:18] deeplinks started …
[21:35:18] deeplinks finished in 46 ms
[21:35:18] transpile started …
[21:35:22] transpile finished in 4.27 s
[21:35:22] preprocess started …
[21:35:22] preprocess finished in less than 1 ms
[21:35:22] webpack started …
[21:35:22] copy finished in 4.60 s
[21:35:29] webpack finished in 7.10 s
[21:35:29] sass started …
Without from option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to undefined to prevent this warning.
[21:35:30] sass finished in 1.20 s
[21:35:30] postprocess started …
[21:35:30] postprocess finished in less than 1 ms
[21:35:30] lint started …
[21:35:30] build dev finished in 12.98 s

cordova run android
Android Studio project detected

(node:8980) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The “chunk” argument must be one of type string or Buffer
at validChunk (_stream_writable.js:253:10)
at Socket.Writable.write (_stream_writable.js:288:21)
at Socket.stream.write (C:\Users\pkhon\AppData\Roaming\nvm\v8.4.0\node_modules\cordova\node_modules\ansi\lib\newlines.js:36:21)
at Object. (C:\Users\pkhon\WebstormProjects\fcmPractice\myApp\plugins\cordova-plugin-fcm\scripts\fcm_config_files_process.js:80:24)
at Module._compile (module.js:660:30)
at Object.Module._extensions…js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
(node:8980) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a p
romise which was not handled with .catch(). (rejection id: 1)
(node:8980) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a no
n-zero exit code.
[21:35:35] lint finished in 4.41 s

[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?

[DEBUG] registerShutdownFunction process.exit/normal shutdown

C:\Users\pkhon\WebstormProjects\fcmPractice\myApp>

for the last point, yes your right it seems 7.0 is in compatible with fcm

Then there is not much you can do about it than downgrading cordova-android.

excellent thanks so much for pointing that out, i changed my cordova to (Cordova CLI) : 8.0.0 and downgraded cordova-android to 6.3 then finally i added

   <preference name="loadUrlTimeoutValue" value="700000" />

in the config.xml file under android platform tag

So working now for you?

yes thanks the emulator now runs and starts the project :slight_smile:

1 Like

change android version to < 7