Ionic-cli: [ERROR] Could not parse build output file: platforms/android/app/build/outputs/apk/debug/output.json

Created on 7 Sep 2020  路  10Comments  路  Source: ionic-team/ionic-cli

Description:
Hello, After I reboot my laptop, my App start throwing this error whenever I try to generate an apk

Steps to Reproduce:
Any of the following commands generate the issue

ionic cordova run android -l --external
ionic cordova run android --device

Note:ionic cordova run android don't generate this issue

Output:

No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking for saved platforms that haven't been added to the project
Platform API successfully found in: /home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/cordova/Api.js
Checking for saved plugins that haven't been added to the project
Generating platform-specific config.xml from defaults for android at /home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/src/main/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
[Gradle Properties] Preparing Configuration
[Gradle Properties] Appending default configuration properties
[Gradle Properties] Updating Gradle property "android.useAndroidX" with the value of "false"
[Gradle Properties] Updating Gradle property "android.enableJetifier" with the value of "false"
[Gradle Properties] Appending custom configuration properties
[Gradle Properties] Updating and Saving File
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/app/src/main/assets/www 
copy ....

Wrote out android application name "Dsuite" to /home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/src/main/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.6): 6
Wrote out Android package name "com.dqlick.web.mobile" to /home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/src/main/java/com/dqlick/web/mobile/MainActivity.java
Updating icons at platforms/android/app/src/main/res
Updating splash screens at platforms/android/app/src/main/res
This app does not have additional resource files defined
Prepared android project successfully
Executing script found in plugin cordova-plugin-androidx-adapter for hook "after_prepare": plugins/cordova-plugin-androidx-adapter/apply.js
cordova-plugin-androidx-adapter: Processed 112 source files in 1670ms
Executing script found in plugin cordova-plugin-androidx for hook "after_prepare": plugins/cordova-plugin-androidx/scripts/apply-to-gradle.properties.js
cordova-plugin-androidx: Updated gradle.properties to enable AndroidX
Executing script found in plugin cordova-plugin-firebase for hook "after_prepare": plugins/cordova-plugin-firebase/scripts/after_prepare.js
Preparing Firebase on Android
No scripts found for hook "before_compile".
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/home/sayto/Android/Sdk/ (DEPRECATED)
Using Android SDK: /home/sayto/Android/Sdk/
Subproject Path: CordovaLib
Subproject Path: app
Gradle Distribution URL: https://services.gradle.org/distributions/gradle-6.5-all.zip

> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
config.xml
../config.xml
../../config.xml
../../../config.xml
preference = 12
name = ScrollEnabled, value = false
name = android-minSdkVersion, value = 22
name = BackupWebStorage, value = none
name = SplashMaintainAspectRatio, value = true
name = FadeSplashScreenDuration, value = 300
name = SplashShowOnlyFirstTime, value = false
name = ShowSplashScreenSpinner, value = false
name = SplashScreen, value = screen
name = SplashScreenDelay, value = 5000
name = GOOGLE_MAPS_ANDROID_API_KEY, value = {AIzaSyC-Oqavhl-l3yELcLZlcVR1vBrXmxIvS3Q}
name = GOOGLE_MAPS_IOS_API_KEY, value = (api key)
name = loadUrlTimeoutValue, value = 700000

> Task :app:stripDebugDebugSymbols UP-TO-DATE
WARNING: Compatible side by side NDK version was not found. Default is 21.0.6113669.
Compatible side by side NDK version was not found. Default is 21.0.6113669.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2s
41 actionable tasks: 41 up-to-date
Built the following apk(s): 
        /home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/build/outputs/apk/debug/app-debug.apk
No scripts found for hook "after_compile".
No scripts found for hook "after_build".
  ionic:lib:cordova:project Error parsing file '/home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/build/outputs/apk/debug/output.json': [Error: ENOENT: no such file or directory, open '/home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/build/outputs/apk/debug/output.json'] {
  ionic:lib:cordova:project   errno: -2,
  ionic:lib:cordova:project   code: 'ENOENT',
  ionic:lib:cordova:project   syscall: 'open',
  ionic:lib:cordova:project   path: '/home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/build/outputs/apk/debug/output.json'
  ionic:lib:cordova:project } +0ms
[ERROR] Could not parse build output file:
        /home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/build/outputs/apk/debug/output.json
  ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
  ionic:utils-process onBeforeExit handler: running 2 functions +0ms
  ionic:utils-process processExit: exiting (exit code: 1) +49ms

My ionic info:

Ionic:

   Ionic CLI                     : 6.11.8 (/home/sayto/.nvm/versions/node/v14.9.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.3.2
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 9.1.12
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 9.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 23 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 1.0.0

System:

   Android SDK Tools : 26.1.1 (/home/sayto/Android/Sdk/)
   NodeJS            : v14.9.0 (/home/sayto/.nvm/versions/node/v14.9.0/bin/node)
   npm               : 6.14.8
   OS                : Linux 5.4

Other Information:
Is the same as this issue #4379 the only difference is the ionic version Probably a workaround will be to downgrade !!

triage

Most helpful comment

I re-upgraded to the latest version 6.11.8, and the problem seems to be gone !! Not sure why?
Note: The output in the issue is while the file exit.
My ionic info output:

Ionic:

   Ionic CLI                     : 6.11.8 (/home/sayto/.nvm/versions/node/v14.9.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.3.2
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 9.1.12
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.1.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 24 other plugins)

Utility:

   cordova-res : 0.15.1
   native-run  : 1.0.0

System:

   Android SDK Tools : 26.1.1 (/home/sayto/Android/Sdk/)
   NodeJS            : v14.9.0 (/home/sayto/.nvm/versions/node/v14.9.0/bin/node)
   npm               : 6.14.8
   OS                : Linux 5.4

All 10 comments

What are the contents of the /home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/build/outputs/apk/debug/ directory?

The directory contains two files app-debug.apk and output.json.
Note: I downgraded to CLI version 6.10.1 as a workaround

But the error says output.json doesn't exist:

[Error: ENOENT: no such file or directory, open '/home/sayto/Desktop/DsuitMobile/mobile-web-repository/platforms/android/app/build/outputs/apk/debug/output.json']

Yah I know, I tried deleting the file, still got the same error. and the file is always created

I need output from the command while the file is still there. It's expected to be there.

I re-upgraded to the latest version 6.11.8, and the problem seems to be gone !! Not sure why?
Note: The output in the issue is while the file exit.
My ionic info output:

Ionic:

   Ionic CLI                     : 6.11.8 (/home/sayto/.nvm/versions/node/v14.9.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.3.2
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 9.1.12
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.1.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 24 other plugins)

Utility:

   cordova-res : 0.15.1
   native-run  : 1.0.0

System:

   Android SDK Tools : 26.1.1 (/home/sayto/Android/Sdk/)
   NodeJS            : v14.9.0 (/home/sayto/.nvm/versions/node/v14.9.0/bin/node)
   npm               : 6.14.8
   OS                : Linux 5.4

Okay, good to hear! Thanks for checking.

I updated today and the issue appeared, my work around was:

ionic cordova platform rm android 
ionic cordova platform add android

And that was it, after that I could do a:
ionic cordova run android

with no problem.

can you drop your ionic info command output. For reference

I started with this one:

Ionic:

   Ionic CLI                     : 6.4.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.3.2
   @angular-devkit/build-angular : 0.1000.8
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 9.0.0, ios 6.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 8 other plugins)

Utility:

   cordova-res                          : 0.15.1
   native-run (update available: 1.1.0) : 0.2.2

System:

   Android SDK Tools : 26.1.1 (/Users/rocco/Library/Android/sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.2
   NodeJS            : v10.16.0 (/usr/local/bin/node)
   npm               : 6.14.8
   OS                : macOS Catalina
   Xcode             : Xcode 12.0 Build version 12A7209

And then I uograded to 6.11.8 and that is when the problem showed.
After I did the steps mentioned before it went away.

Was this page helpful?
0 / 5 - 0 ratings