简体   繁体   中英

ionic cordova run android stops working after last updates

After installing ionic@5 (with native-run) i can't deploy the apk with the command:

ionic cordova run android --device --verbose

It crashes with the following error

Error: Command failed: D:\android-sdk\platform-tools/adb -s 40467d5 shell getprop

    at ChildProcess.exithandler (child_process.js:294:12)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982: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.

I've done this checks
- I've tried with different version of android SDK (9+,9,8) but the result is the same.
- I've tried with the flag --no-native-run and it crashes in simular way in the same phase (after building apk).
- The failed command works fine if manually launched on cmd, or at least it gives good results

I think this is partially related to this issue https://github.com/ionic-team/native-run/issues/42 because i have this issue too.

This is my ionic info

Ionic:

   Ionic CLI                     : 5.0.1
   Ionic Framework               : @ionic/angular 4.4.2
   @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 CLI       : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : 0.2.4

System:

   Android SDK Tools : 26.1.1 (D:\android-sdk)
   NodeJS            : v10.16.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

I partially solved by doing these steps:

  • install ionic@5.0.1 (globally and inside project), cordova 9.0.0 -g
  • downgrade "Android SDK Platform-Tools" at version 28.0.3: i notice that with the latest 29.0.0 the command stucks for a moment before ending skipping the wlan devices section (stopping at wifi section). With version 28 it ends with no hanging
  • (optionally) downgrade to android studio 3.4.0 (i will update later)
  • use the flag --no-native-run : native-run currently is not working well with ionic toolchain (detecting real devices); btw by using directly from command line works well

All you're gonna find are things like: "this solution worked for me, but not for them", "it works in some cases", "pray to God and maybe this can help you", "uninstall this, update that and remove that other one" ... But you won't find a straight answer and a well defined number of steps to follow in order to make things work... I'm not criticizing a particular product, but this new 'paradigm' of programming in which you need to be 'really lucky' in order to meet a combination of Product_A_v1, Product_B_v4.5 and Product_C_v0.1 which "works fine, but doesn't work in any other possible combination", ohhh, and all that just on Windows, if you are using Linux, well.. you neead at least 12K available hours to find out how to make things work... just to find out how to start... no matter your 20 years of experience programming or all your degrees, because there is no right way of making things work, just 'good luck' ... This is the new norm: things work 'in some cases'. Good luck :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM