Description
First time configuring and running android application on a mac.
When running the command, ionic cordova run android --verbose, build is successful but fail to parse the output file and run simulator. Please provide an insight to resolve this issue.
Steps to Reproduce:
run command
ionic cordova run android --verbose
Output:
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 1s
39 actionable tasks: 39 up-to-date
Command finished with error code 0: /Users/xy/devproj/platforms/android/gradlew cdvBuildDebug,-b,/Users/xy/devproj/platforms/android/build.gradle
Built the following apk(s):
/Users/xy/devproj/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 Output file does not match expected format: {
ionic:lib:cordova:project version: 1,
ionic:lib:cordova:project artifactType: { type: 'APK', kind: 'Directory' },
ionic:lib:cordova:project applicationId: 'io.ionic.starter',
ionic:lib:cordova:project variantName: 'debug',
ionic:lib:cordova:project elements: [
ionic:lib:cordova:project {
ionic:lib:cordova:project type: 'SINGLE',
ionic:lib:cordova:project filters: [],
ionic:lib:cordova:project properties: [],
ionic:lib:cordova:project versionCode: 1,
ionic:lib:cordova:project versionName: '1',
ionic:lib:cordova:project enabled: true,
ionic:lib:cordova:project outputFile: 'app-debug.apk'
ionic:lib:cordova:project }
ionic:lib:cordova:project ]
ionic:lib:cordova:project } +0ms
[ERROR] Could not parse build output file:
/Users/xy/devproj/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) +19ms
My ionic info:
Ionic:
Ionic CLI : 6.10.0 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.1.1
@angular-devkit/build-angular : 0.901.7
@angular-devkit/schematics : 9.1.7
@angular/cli : 9.1.7
@ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0, ios 5.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins)
Utility:
cordova-res : 0.14.0
native-run : 1.0.0
System:
Android SDK Tools : 26.1.1 (/Users/xx/Library/Android/sdk)
ios-deploy : 1.10.0
ios-sim : 8.0.2
NodeJS : v12.18.0 (/usr/local/bin/node)
npm : 6.14.4
OS : macOS Catalina
Xcode : Xcode 11.5 Build version 11E608c
Other Information:
I've had the same issue for a few weeks now (not sure what I did to introduce it 馃槙 ).
A workaround I'm using is to run ionic cordova build android, since it _is_ able to build an APK before it dies on the output file, then run native-run android --app path/to/apk. This installs the app and runs it successfully.
However, it'd be nice if ionic cordova run android would just work. This workaround does _not_ work with a live-reload server (which I'd normally launch via ionic cordova run android -l), which is pretty unfortunate.
My ionic info (I'm on Windows btw...not sure if that makes a difference):
Ionic:
Ionic CLI : 6.10.0
Ionic Framework : @ionic/angular 5.1.1
@angular-devkit/build-angular : 0.901.7
@angular-devkit/schematics : 9.1.7
@angular/cli : 9.1.7
@ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0, ios 5.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.14.0
native-run : 1.0.0
System:
Android SDK Tools : 26.1.1
NodeJS : v12.14.1
npm : 6.13.4
OS : Windows 10
Any solutions to this problem? I'm facing the same issue.
Ionic:
Ionic CLI : 6.10.0
Ionic Framework : @ionic/angular 5.0.4
@angular-devkit/build-angular : 0.803.25
@angular-devkit/schematics : 8.3.25
@angular/cli : 8.3.25
@ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0, browser 6.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 25 other plugins)
Utility:
cordova-res : not installed
native-run: 1.0.0
System:
Android SDK Tools : 26.1.1
NodeJS : v12.15.0
npm : 6.14.5
OS : Windows 10
What are the contents of platforms/android/app/build/outputs/apk/debug/output.json?
@dwieeb
{
"version": 1,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "REDACTED",
"variantName": "debug",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 104,
"versionName": "104",
"enabled": true,
"outputFile": "app-debug.apk"
}
]
}
Weird, that's totally unlike mine and I have the same versions of everything.
[
{
"outputType": {
"type": "APK"
},
"apkData": {
"type": "MAIN",
"splits": [],
"versionCode": 1,
"versionName": "1.0",
"enabled": true,
"outputFile": "app-debug.apk",
"fullName": "debug",
"baseName": "debug",
"dirName": ""
},
"path": "app-debug.apk",
"properties": {}
}
]
~Do you use some sort of custom build tool for Android?~
This might be related to the gradle version. What version does your app use?
@dwieeb I think it's Gralde 6.2.2? Below is output from gradle -v if that's what you're after.
------------------------------------------------------------
Gradle 6.2.2
------------------------------------------------------------
Build time: 2020-03-04 08:49:31 UTC
Revision: 7d0bf6dcb46c143bcc3b7a0fa40a8e5ca28e5856
Kotlin: 1.3.61
Groovy: 2.5.8
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_251 (Oracle Corporation 25.251-b08)
OS: Windows 10 10.0 amd64
I recall when first setting up the project (first adding the android platform, I think), I had to do something janky with something Android- or Gradle-related to fix an issue. I can try to reproduce that after the weekend and see if I tweaked something to make our versions diverge.
@gireeshspr Don't let me commandeer your issue if you have details different from mine. I can start a new one to separate concerns if necessary.
@zrev2220 Based on the output of the file in the output provided by @gireeshspr, I can confirm you have the same issue, so no worries.
I think this is what I'm after:
./platforms/android/gradlew --version
@dwieeb Ran that command, identical output:
$ platforms\android\gradlew --version
------------------------------------------------------------
Gradle 6.2.2
------------------------------------------------------------
Build time: 2020-03-04 08:49:31 UTC
Revision: 7d0bf6dcb46c143bcc3b7a0fa40a8e5ca28e5856
Kotlin: 1.3.61
Groovy: 2.5.8
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_251 (Oracle Corporation 25.251-b08)
OS: Windows 10 10.0 amd64
Sorry for the delay in response, problem still exists. My output json is already there in the request but its not well formatted in the copy paste. Yes my output resembles exactly the same. @dwieeb is correct.
{
"version": 1,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "io.ionic.starter",
"variantName": "debug",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 1,
"versionName": "1",
"enabled": true,
"outputFile": "app-debug.apk"
}
]
}
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_251 (Oracle Corporation 25.251-b08)
OS: Mac OS X 10.15.5 x86_64
This appears to be related to the Gradle version used. I wasn't able to narrow down exactly where output.json is generated. If anyone has insight into this it would be greatly appreciated!
I am making a release with this fix now.
Okay, 6.10.1 is out! Please let me know if you run into any more issues. Thanks! 馃挋
Excellent @dwieeb! Your changes on the latest Ionic CLI build 6.10.1 works. Thanks
I'm still seeing this problem when running: ionic cordova run android -lc --release --prod --device
This is my ionic info:
Ionic:
Ionic CLI : 6.11.7 (/Users/marioacarlos/.nvm/versions/node/v12.16.2/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.3.2
@angular-devkit/build-angular : 0.901.12
@angular-devkit/schematics : 10.0.0
@angular/cli : 9.1.12
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res (update available: 0.15.1) : 0.14.0
native-run : 1.0.0
System:
Android SDK Tools : 26.1.1 (/Users/marioacarlos/Library/Android/sdk)
ios-deploy : 1.10.0
ios-sim : ios-sim/9.0.0 darwin-x64 node-v12.16.2
NodeJS : v12.16.2 (/Users/marioacarlos/.nvm/versions/node/v12.16.2/bin/node)
npm : 6.14.5
OS : macOS Catalina
Xcode : Xcode 11.6 Build version 11E708
Any ideas?
@MarioC3 Can you supply all the information I asked for in this issue? ionic info isn't enough.
I have the same issue with cli 6.11.8, I've created a new issue #4546
Most helpful comment
Okay, 6.10.1 is out! Please let me know if you run into any more issues. Thanks! 馃挋