Error "ionic cordova run android " after native-run and IONIC 5 update

Hi guys,

After having updated native-run, the command ionic cordova run android --device has stopped working.

I have everything updated, Android Studio SDK and yours corresponding packages.

Ionic info:

Ionic:

   Ionic CLI                     : 5.0.1 (C:\Users\nuria\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.3.1
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.3.8
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 7 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.4

System:

   NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

The error is:

> native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk --device
Error: Command failed: C:\Users\nuria\AppData\Local\Android\Sdk\platform-tools/adb -s RF8M204LVHX shell getprop

    at ChildProcess.exithandler (child_process.js:294:12)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
[ERROR] An error occurred while running subprocess native-run.

        native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-d... exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

Any ideas?

3 Likes

Same issue here, I’ve been stuck on it since the 5th of June

1 Like

It’s fixed now. Update your ionic-cli with npm i -g native-run@latest

1 Like

You need update IONIC CLI (v 5) and platforms-tool of android in v 28

I’ve got android sdk v28 installed but every time I run ionic info it only shows 26.1.1. How do i get it to to upgrade?

2 Likes

Remove platform from your project and reinstall with ionic cordova prepare android

I try all your suggestions, all packages updated (ionic 5.2.3, native-run 0.2.8, cordova 9.0.0), platforms removed (also manually from config.xml), ionic repair, re-adding platform ionic cordova platform add android, generating resources ionic cordova resources and nothing…

Finally, I try downgrading Ionic to version 4.12.0 and it work it! Later I try to update to 5.0.0 and run again and the error appears again. It seems to be because of the version. Is it appening to someone else?

Ionic:

   ionic (Ionic CLI)             : 4.12.0
   Ionic Framework               : @ionic/angular 4.7.1
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : android 8.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 5 other plugins)

System:

   NodeJS : v10.7.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.10.2
   OS     : Windows 10

I’ve done probes in different PCs and I’m pretty sure that its’s caused by device permissions (even though I’ve configured the USB debugging and accept the permissions from device).

For me the problem came from Firebase, I uninstalled it to fix the problem (Latest version of firebase, ionic and cordova).

ionic cordova platforms remove android
ionic cordova plugin remove cordova-plugin-firebase
npm uninstall @ionic-native/firebase
ionic cordova platforms add android

Thank you for your response, I will try only for confirm. But for develop, I need those packages so I eventually have to reinstall.

I’m using a VM, host is windows 10, client is Linux (Ubuntu 18.04.3 LTS) and I have the same problem.
But using a VM Windows 10 with the same app development environment and same host, it run. Device is a Samsung A5.
So I think that the problem is coming from usb…

npm i -g native-run
will also resolve the issue

Finally I’ve achived with the last Ionic version v5.2.7.
First, uninstalling Android Studio and whole sdk occurrences (at C:\Android, Users, AppData, Documents…).
Second, reinstalling Android Studio and setting the sdk directory at C:\Users<my-user>\Library\Android\sdk.
Next, I’ve add the system environment variables:

  • ANDROID_HOME: C:\Users<my-user>\Library\Android\sdk
  • PATH:
    • %ANDROID_HOME%\tools
    • %ANDROID_HOME%\tools\bin
    • %ANDROID_HOME%\platform-tools
    • %ANDROID_HOME%\emulator

(It’s recommended to restart or at least to close and re-open command line console to catch new variables)

Then, run Android Studio and confirm the new sdk location if you didn’t set before. Enter in SDK Manager and install the Android versions fot your test devices.
Finally, return to your IDE and run ionic cordova run android

That’s works for me :smiley:

2 Likes

this worked for me… thank you.

not worked for me got same error

After multiple attempts of installing and uninstalling node, ionic and cordova,
Some how this solved my problems :slight_smile:

Thanks a lot mate

I have updated everything like you said, but my platform-tool of android is v 29. It’s not working for me. Any Help…

mybe you forgot developer option install via usb