How to see Console log output in samsung galaxy S2 - javascript

I am using samsung galaxy s2 version 2.3.3, i open a web page in android default web browser.
In the Page i put console.log("some info") to debug the page, but i am unable to see the console.log output in my device.Please help me in this.Thanks in advance.

Warning: No Longer Working!
This solution appears to no longer be functional as the web tool has not been maintained over the years.
Try using JSConsole.com. It's a remote debugger for JavaScript. The setup is basically just injecting a <script> tag in your page. Once connected you can read all the console.log calls from the remote page on JSConsole, as well as execute commands on the client.
Steps to Setup
Go to JSConsole Home Page, and type :listen.
Copy the resulting <script src="http://jsconsole.com/remote.js?..."></script>.
Drop that into the page you need to debug.
Open your page in any browser (phone, tablet, desktop, etc). All console.log calls will be forwarded to the JSConsole.com window.
There are more details plus a couple of useful videos on the Remote Debugging Page.

In Two ways we can see console.log messages
Using WEINRE
Using Eclipse
Method 1:
Use WEINRE remote WEb Inspector in REmote. it is a nodejs package. Steps to install WEINRE.
Install nodejs
run this command to install weinre :npm install -g weinre (for
MACsudo npm install -g weinre)
Then launch WEINRE: weinre --boundHost -all- --httpPort 8082, here
8082 is port number where WEINRE is launched.
Then add the following script tag in the HTML/web page you want to
debug or to see console messages, <script
src="http://xx.xx.xx.xx:8082/target/target-script-min.js#weinredemo"></script>
xx.xx.xx.xx is the IP of your machine.
weinredemo is the ID for your page and you can use any of our own.
Then open the page , where you want to see console messages in any mobile device.
Open this page any webkit
browser,http://localhost:8082/client/#weinredemo
There go to console tab and see the messages.
Method 2:
please connect your mobile via USB drive and see the phone listed in ECLIPSE and need to install ANDROID ADT plugin for eclipse to see the console messages in Eclipse.

Related

webpage could not be loaded because net::ERR_ADDRESS_UNREACHABLE

we are using vue ui to manage a fresh vue project (vue cli 3) included vue-router, vuex and cordova plugins. we run the command 'npm run cordova-serve-android' and app be open in my device but webpage not available.
we tried open url in browser of PC: https://10.253.29.21:8081 . this url after security alerts be open and request some info in fields that are filled automatically! I press enter(for 2 or 3 times) then web page be open my app but in android device no!
Note: device and PC connected to same Wifi modem and internet connection.
You may still have problems with your router setup. I would check corresponding options for allowing local devices to be discover-able on both your PC and router.

sending console JS commands to an Electron app

I'm looking to automate an existing Electron app. It gives access to the Developer Tools, so I could just paste Javascript code into the console, but there must be a way to do this remotely, ideally using Node or from the Terminal?
I've seen this option for running Chrome : --remote-debugging-port=9222 ... that hints at a solution but I can't seem to get closer.
If you launch your Electron app with --remote-debugging-port=9222 then you will enable remote debugging via Chrome DevTools protocol. You can use a Chrome developer tools instance as a client, or use one of the clients here: https://github.com/ChromeDevTools/awesome-chrome-devtools#chrome-devtools-protocol
The debuggable Chrome instance will be running on localhost:9222. Which means as long as you are trying to debug from the same machine you are fine. However if you want to debug from a remote machine you need some additional setup.
Setup an SSH tunnel on the source machine:
ssh -L 0.0.0.0:9223:localhost:9222 localhost -N
This will accept incoming traffic on the 9223 port and route it to Chrome remote debugging.
Then on your client machine use the address: source-machine-ip:9223 to access the remote debugging.
Note: This may not work on Windows without additional SSH setup as SSH is not prepackaged with Windows.

React native running on the device error

my react native app wont run when the device is connected on my laptop.. but the app will run successfully on genymotion. I dont know what the problem is. Can anyone suggest me some solutions to this problem. Thank you
This is problem i get on my device, but no problem when running on genymotion
check this out, probably you not set up your dev server
https://facebook.github.io/react-native/docs/running-on-device-android.html#configure-your-app-to-connect-to-the-local-dev-server-via-wi-fi
Make sure your laptop and your phone are on the same Wi-Fi network.
Open your React Native app on your device. You can do this the same way you'd open any other app.
You'll see a red screen with an error. This is OK. The following steps will fix that.
Open the Developer menu by shaking the device or running adb shell input keyevent 82 from the command line.
Go to Dev Settings.
Go to Debug server host for device.
Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081). On Mac, you can find the IP address in System Preferences / Network. On Windows, open the command prompt and type ipconfig to find your machine's IP address (more info).
Go back to the Developer menu and select Reload JS.
what your android version device ?
the first think should you do after your plugg in your device via usb, check that your device is properly connecting to ADB by running adb devices.
Open your cmd find your adb directory path example : C:\Users\your_name\AppData\Local\Android\sdk\platform-tools
Run $ adb devices and see list devices attached. U must have one devices only one device connected at a time.
After check devices are connected and then run your app $ react-native run-android.
If your android version 5.0 lollipop running the following in your cmd $ adb reverse tcp:8081 tcp:8081 and you can reload your aplication, but if still error you can run via wi-fi, you can use this tutorial if you run via wi-fi, but you'll first need to install the app on your device using a USB cable.

How to watch console.logs in ionic emulator?

I'm building an app using the Ionic framework, which I've done in the browser until now. Because I now want to use the cordovaOauth plugin I need to use the emulator. The problem is that I can't see any console.log() in the emulator as I do in the browser, which makes it hard to debug.
Does anybody know how in Ionic/Cordova I can make use of console logging in the emulator? All tips are welcome!
Just enable the console logs in the emulator. Here my example:
> ionic emulate ios --livereload
Setup Live Reload
Running dev server: http://localhost:8100
Adding in default Ionic hooks
Running live reload server: http://localhost:35729
Watching : [ 'www/**/*', '!www/lib/**/*' ]
Ionic server commands, enter:
restart or r to restart the client app from the root
goto or g and a url to have the app navigate to the given url
consolelogs or c to enable/disable console log output
serverlogs or s to enable/disable server log output
quit or q to shutdown the server and exit
Type consolelogs in the command line and hit enter.
consolelogs
Console log output: enabled
Loading: /?restart=382451
ionic $ 0 498458 log Hi there! This is from console.log
run ionic emulate ios -l -c
This will open the emulator with livereload feature, and you'll see all the console logs in the terminal.
To turn the console logs off (or on) just write consolelogs or just c in the terminal while the ionic server is running
Another very convenient way to debug your app when using iOS emulator/device is using the Safari developer tools
When the app runs - enter Safari and choose "Develop > iOS Simulator > your page"
If you work with a real device you'll see the device's name instead of "iOS Simulator"
If you don't see the "Develop" menu in safari - enter Safari's preferences and enable it from the "advanced" tab
If you wan't to watch console logs in emulator / simulator use
ionic emulate -l -c <PLATFORM>
If you wan't to watch console logs when testing in device you can launch this command :
ionic run -l -c <PLATFORM>
-c = --consolelogs : Print app console logs to Ionic CLI (livereload req.)
-l = --livereload : Live reload app dev files from the device
May help someone !
If you are testing your web app with a device running Android 4.4 or higher, you can remotely debug your web pages in WebView with Chrome Developer Tools. Just open chrome://inspect on your desktop with the phone in USB Debugging mode connected.
There are a few ways to debug your ionic app.
In the browser you can catch the errors in the console.
If you are emulating your app on a simulator or a mobile device you can install the cordova plugin that displays js errors in the xcode console. So you can emulate your device and catch errors on xcode.
Here is how you add the plugin:
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
Hope this helps! It came in very handy for me while I was debugging GeoFire errors and testing the cordova camera and geolocation api.
On Ionic 3, you can do this by
ionic cordova run android --emulator -l -c
Replace android with ios depending on your requirements. More information here: https://ionicframework.com/docs/cli/cordova/run/

No targets shown in WEINRE (Cordova/PhoneGap)

I've been trying to connect my device to weinre, yet I cannot see any target device in it.
This are the steps I'm following:
Creating project in Cordova
Adding android platform to the project
Adding the weinre script to my project's index.html
Initiating weinre server in my computer
Pinging both devices IP from each other to ensure they can see each other over the network
Opening weinre server in my chrome browser
Running my App
No target ever appear
Please if I'm doing something wrong tell me, but can't see, to connect any target itno my weinre server.
Best regards.

Categories

Resources