ionic-cli: Error: ENOENT: no such file or directory, open platforms/android/app/build/outputs/apk/debug/app-debug.apk

Description:

When i try to use the classic way to launch an ionic app into a device (ionic cordova run android --device) builds perfectly but native-run fails locating the app source file. The built app is in

platforms/android/build/outputs/apk/android-debug.apk

but the native-run goes to

platforms\android\app\build\outputs\apk\debug\app-debug.apk

looking for a folder called app inside android that does not exist

Steps to Reproduce:

Run ionic cordova run android --device

Output:

BUILD SUCCESSFUL

Total time: 18.968 secs
Built the following apk(s):
        D:/Projects/lvlLite-ionic4/platforms/android/build/outputs/apk/android-debug.apk
> native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk
No hardare devices found, attempting emulator...
Selected emulator PM1LHMA7C2202496
Error: ENOENT: no such file or directory, open 'D:\Projects\lvlLite-ionic4\platforms\android\app\build\outputs\apk\debug\app-debug.apk'
[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.

My ionic info:

Ionic:

   Ionic CLI                     : 5.0.0 (C:\Users\alvar\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.4.2
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.2.4
   @ionic/angular-toolkit        : 1.3.0

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 6.3.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 10 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.2

System:

   Android SDK Tools : 26.1.1 (C:\Users\alvar\AppData\Local\Android\Sdk)
   NodeJS            : v11.6.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.5.0-next.0
   OS                : Windows 10

Other Information:

My workaround to this was use

ionic cordova run android --no-native-run

and works as usual

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 19 (6 by maintainers)

Most upvoted comments

@alvarofelipe12 If you need to use cordova-android 6, you should use the --no-native-run flag for now.

@vagnersabadi Can you post log output? If you’re getting this issue with cordova-android 7, then something is wrong.

The same with cordova updated after Ionic update to 5.0.1

Ionic info:

   Ionic CLI                     : 5.0.1 (C:\Users\Pietro\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.2.0
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.4.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : 0.2.2

System:

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

@alvarofelipe12 Update your android platform to 7 or 8.

ionic cordova platform rm android
ionic cordova platform add android

@alvarofelipe12 I explained what you need to do to continue using cordova-android 6: https://github.com/ionic-team/ionic-cli/issues/4002#issuecomment-500536615

I think I found a solution, actually until 05/29/2019 I was using version 4.12.0 after this day my CLI was updated to version 5.0.0 and second this documentation has undergone many changes.If anyone has this problem read the release notes (which I did not do) to see if there is any change