I am new to ionic I am following ionic framework documents to learn it.
Here is my method's code: hello-ionic.ts
openActionSheet(){
let actionSheet=this.actionsheetCtrl.create(
{
title: 'Modify your album',
cssClass: 'page-hello-ionic',
buttons:[
{
text: 'Delete',
role: 'destructive', //will always sort to be on top
icon: !this.platform.is('ios') ? 'trash' : null,
handler: () => {
console.log('Delete clicked');
}
},
{
text: 'Play',
icon: !this.platform.is('ios') ? 'arrow-dropright-circle' : null,
handler: () => {
console.log('Play clicked');
}
},
{
text: 'Favorite',
icon: !this.platform.is('ios') ? 'heart-outline' : null,
handler: () => {
console.log('Favorite clicked');
}
},
{
text: 'Cancel',
role: 'cancel', // will always sort to be on the bottom
icon: !this.platform.is('ios') ? 'close' : null,
handler: () => {
console.log('Cancel clicked');
}
}
]});
actionSheet.present();
}
The code works fine. But I want to know that where is console.log() printed. Can anyone help me with that?
To check the console log you can use browser and run the below command:
Step 1: $ionic serve (will run your app on localhost)
Step 2: In your respective browser (chrome, safari, etc...) where your app is running Right + click and inspect your app as per below screenshot.
Step 3: You will get a window with HTML elements on the right side of your browser window and on the left your app screen.
Step 4: On the right side window, you can find "Console" menu option on the top bar. Click on that you will get your console where you find your app logs or error or warning which ionic generated.
EDIT:
Real Device or Emulator debugging
To check real-device or emulator or genymotion console logs follow the below steps & screenshots.
Step 1: Run this command to run your app on real-device or emulator
$ionic cordova run android
Step 2: After successfully launch the app on device or emulator Go to Chrome browser and Right + click and click on "Inspect" and you will get below screen at bottom of your browser.
Step 3: Click on "Remote devices" will show connected real device or emulator list.
From that device list click on "Inspect" button on the right side of that device name(check screenshot for the same) will open a new window with your device mirror now console is yours play around with this debugger.
Hope this will help you to debug your app.
if you want to get Live console logs in the ionic application (real
device or emulator)
ionic cordova run android --livereload --consolelogs --serverlogs
you can use chrome inspect to get console logs while debugging with emulator.
open chrome and enter following :
chrome://inspect:device
you can see ionic device listed in the devices and you can use inspect and check the console.logs as described in this video
When I test websites on mobile using Ionic, I usually prefer not to run the Remote devices window as I need to choose the mobile, then tons of tabs in my mobile browser - then inspect and after a refresh on mobile - it disconnect ...
For real debugging purposes, I prefer running Ionic with -c like so, and then I see the console in the terminal w/o anything being disconnected.
my-server$ ionic serve -c --no-open --address 192.168.1.112
[INFO] Development server running!
Local: http://192.168.1.112:8100
Use Ctrl+C to quit this process
Browsing in my mobile device to: http://192.168.1.112:8100
logs will appear in terminal where I run Ionic cli:
[app-scripts] [09:49:42] console.log: Angular is running in the development mode. Call enableProdMode() to enable the production
[app-scripts] mode.
[app-scripts] [09:49:42] console.log: cookieEnabled: true
Test on iOs
Run ionic capacitor run ios --livereload, this will show you a list with the iPhone emulators options, choose the one that you want and it will be opened
After the application be opened in the emulator you have to go and open the Safari browser, then in the top options go-to develop->simulator->localhost and that will open a window which will show you the logs that you want
Test on Android
Run ionic capacitor run android --livereload this will show you a list with the Android device emulators that you have created on Android Studio (be sure to have Android Studio and adb properly installed, updated and configurated), choose the one that you want and it will be opened
After the application be opened in the emulator you have to go and open the Google Chrome browser, then go to chrome://inspect/#devices and find your emulated or physical device in the bottom list (some times could take a few minutes to appear) and then click on inspect after that, a console window will be open and you will be able to see all your logs
NOTE: This has been done and tested on Ionic 5
Please use web browser to see the console logs.
Run the ionic serve command by terminal to run the ionic in your browser.
If you couldn't see the console logs in your browser, simply use console.warn... it's a alternative solution to see the logs
Related
I'm trying to hot reload my flutter app that runs on a browser but whenever i run ctrl + f5 or f5 a new blank browser window appears.
Can someone help please
may be you can try flutter run -d chrome to Run Chrome using the default renderer option
I am running my flutter app successfully on my emulator. However, I need the use of the Widget Inspector for testing purposes.
To run my app I use the following:
flutter run --flavor dev -t lib/main_prod.dart
However, when I use the palette to bring up the "Open DevTools" I end up getting what is shown in the image
I've run flutter clean before running my app and it still didn't work.
Please help!
Never mind, I figured it out.
I was looking for the typical pop-up tool bar and overlooked this:
Simply pressing "h" for "List all available interactive commands." brought up a more comprehensive list with the option for an inspector:
Pressing "v" to open the flutter tools here works.
I have searched and tried a lot of methods.
One works for me is this command flutter run -d chrome --release.
What a pity that no debug info print out.
When i run it directly by pressing button in Android studio, my website showed nothing but white screen.
I got follow message from the Console
Launching lib\main.dart on Chrome in debug mode...
Syncing files to device Chrome...
I want to run it and get debug info. Who has good ideas?
Problem finally be solved, Firstly, Press F12 when you deploy your web to your Chrome browser. Then all debug info will be printed in Chrome Console. My problem is caused by
require.js:1959 Not allowed to load local resource: file:///E:/project/flutter_afast/lib/model/builder.dart
req.load # require.js:1959
Which caused by a import of absolute path(local path E:/...) in my dart file. Change this to relative path then work that problem out.
I can see the device list on VSCode in Windows.
And I can select any one.
And the emulator is opening.
But I can see a single message. "Waiting for a connection from Flutter.."
Application does not open.
It doesn't get any errors either. Waiting like this.
Make sure that your API level you're running your device on is the
same as what you have installed on Android Studio.
1.1 Click on the SDK Manager button around the top right corner of AS (The icon is a box with a down arrow next to it).
1.2 Choose the same API level as your device, (When I didn't do this I had a partial install and it took some time to compile), then
click apply and wait for it to install.
We're going to run the project to our avd or mobile device from the directory of ourproject.
2.1 Open up the Command Prompt (preferably as Admin), and chage the directoy to where your project is, the command should look something
like this:
cd Documents/flutterprojects/yourflutterproject.
2.2 Finally type the command flutter run.
Restart the Emulator by holding the power Button and Selecting restart and then try again.
if that failed to work, simply restart your computer.
I want to use electron js in order to build a desktop app, which will run on a Raspberry Pi 3B. I'm developing the app on my macbook. There, I can use the command electron . without any problems. If I try to start the electron-quick-start app, the following happens:
I execute the following command in the terminal in the directory of electron-quick-start: electron .
The electron window opens with the correct background color
No html content is shown
I tried building the app with the electron-packager for the armv7l architecture and running it on the raspberry pi. This works, but it is a tedious task to build the app every time to test it on the Raspberry Pi.
Do you have any ideas, why the electron . command doesn't work?
UPDATE: I started debugging the main.js file:
webContents.on('did-start-loading', function() {
console.log('did-start-loading');
});
webContents.on('did-stop-loading', function() {
console.log('did-stop-loading');
});
webContents.on('did-finish-load', function() {
console.log('did-finish-load');
});
webContents.on('did-get-response-details', function(e, status, newUrl) {
console.log(newUrl);
});
And I get the following response:
did start loading
did stop loading
UPDATE 2:
I uncommented the mainWindow.webContents.openDevTools() line, so actually the chromium dev tools should start, but they don't...
Thanks for your help.
After the debugging and the fact, that the developer console wasn't working, I quickly came to the conclusion, that chromium is crashing.
I thereafter found this issue in the electron github repository:
https://github.com/electron/electron/issues/12850
It looks like the used version in the electron-quick-start demo (1.8.x) is not working on ARM processor. The version "2.0.0" works again.