This console.log function work with running on 'ionic serve' the browser show console.log.
But running on 'ionic run android -lc' or 'ionic run android' --livereload --consolelogs' not work console logs on android device.
Using Ionic 2 RC2 the console.log function works from the android device, with the update to RC3 stopped working.
Steps to reproduce:
constructor(public navCtrl: NavController) {
/**
* This console.log function work with running on 'ionic serve'
* the browser show console.log.
*
* But running on 'ionic run android -lc' or 'ionic run android' --livereload --consolelogs'
* not work display console logs on android device.
*/
console.log('Constructor Home Page');
}
testConsole() {
/**
* This console.log function work with running on 'ionic serve'
* the browser show console.log. Event click button.
*
* But running on 'ionic run android -lc' or 'ionic run android' --livereload --consolelogs'
* not work display console logs on android device. Event click button.
*/
console.log('Click on button Test Console Log');
}
Post the output of ionic info below please
sebaxtian@Satellite [ test ] >> sudo ionic info
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v5.12.0
Xcode version: Not installed
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
This is my project, https://github.com/sebaxtian/ionic2-angular2/tree/master/test using the console.log function in the home.ts file
home.ts file: https://github.com/sebaxtian/ionic2-angular2/blob/master/test/src/pages/home/home.ts
home.html file: https://github.com/sebaxtian/ionic2-angular2/blob/master/test/src/pages/home/home.html
package.json file: https://github.com/sebaxtian/ionic2-angular2/blob/master/test/package.json
1. run: ionic serve (this will work fine for console.log)

2. run: ionic run android -lc (this will not work fine for console.log)

Change in the package.json file:
Replace: "ionic:serve": "ionic-app-scripts serve"
With: "ionic:watch": "ionic-app-scripts watch"
"scripts": {
"ionic:build": "ionic-app-scripts build",
"ionic:watch": "ionic-app-scripts watch"
}
Change in the package.json file

I think you should reopen the bug, the problem should not be the app/script but the ionic cli. With 1.2.8 the log does work well.
I think this issue should be reopen as well. What I'm experiencing is as follow:
If I run ionic run android -lc with an UNmodified package.json the live reload works well but the logs won't show up
If I run ionic run android -lc with a Modified package.json the console logs will show up but the livereload won't work anymore
If I run ionic run android --livereload --consolelogs both livereload and consolelogs work as expected, however it won't detect that it's running in a device
anybody else is having this behaviour?
Hi @tonirilix, I tried a lot but I can't reproduce your scenario, also --livereload --consolelogs dosn't work for me. But I can not do run because I brooked my android phone, so it's always only a emulating device.
You can see here
https://github.com/driftyco/ionic-cli/issues/1695#issuecomment-265353928
and here
https://github.com/driftyco/ionic-app-scripts/pull/492#issuecomment-265353659
where we discuss this
Thanks a lot @mburger81. I'll be following that thread.
Can you test as described in my links if installing ionic@test (2.1.15) is resolving the issue for you? Are you on ionic-angualr RC.3?
Please join first link/issue
Yes, I'm using ionic RC.3.
I just tried ionic@test (2.1.15) in an clean project and it's not resolving the issue for me.
I'll join now.
I was experiencing this issue and sebaxtian fix solved the issue.
Most helpful comment
[SOLVED]
Change in the package.json file:
Replace: "ionic:serve": "ionic-app-scripts serve"
With: "ionic:watch": "ionic-app-scripts watch"
"scripts": { "ionic:build": "ionic-app-scripts build", "ionic:watch": "ionic-app-scripts watch" }Change in the package.json file
