Cordova console.log not working - javascript

Hello I downloaded and installed node.js as I have done million times also I installed cordova as mentioned in their docs. Furthermore I installed console.plugin with "cordova plugin add org.apache.cordova.console". Finally I did cordova build android and the cordova emulate android, and inside www/js/index.js onDeviceReady I simply entered this console.log('test');
I'm new with cordova and I cant figure out why I dont see and output in my terminal.
PS: I'm on ubuntu 12.04 LTS 64bit, and I dont use eclipse. Shouldn't I see the console.log output in my terminal window ?

From the CLI run your Android project and display console output from chromium (if using Crosswalk) or SystemWebViewClient. View Debugging priority and above logs from these places, and silence everything else.
cordova run android && adb logcat chromium:D SystemWebViewClient:D *:S

Using alert() is a rather dilettantish debug methodology. The most simple is to use a hardware device or an emulator with adb and chrome://inspect. This provides the debug bridge for the Cordova WebView, as well as the JS console, JS debugger, DOM inspector, etc. within Chrome.
See Get Started with Remote Debugging Android Devices.

The output will appear in an output window, not in the terminal window.
I run my Android Cordova apps in Eclipse and logs appear in the Logcat output window, similarly with iOS apps and Xcode, they appear in the Xcode output window.
You could always just alert() or navigator.notification.alert() to quickly see your logged values.
Hope this helps.

Related

Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. , Failed to install the app

enter image description here
Im new to React-Native and this is driving me insane, I just want to launch the project in the and view the project in the emulator so I can just start coding, I have tried downloading the latest version of JDK, which is apparently not even needed since android studio comes bundled with its own version & also how do I know what version of JDK my android studio comes bundled with ?
I have been trying to fix this for days now, I even got Blue screen of death when after I messed around with the enviroment variables so now I am desperate and want someone to point me in the right direction.
React native install app on a single running device. Make sure your emulator is in running condition
check all connected devices which are eligible for installing using a command
adb devices
one device at a time
Please check your JDK path for android and ios, if all things are correct the see the project files in the project.
Then run your project.
I hope it runs.

Android Emulator Logging Via JavaScript

I am running an Ionic app integrated with SalesForce Mobile SDK. I am running it in Android Studio, because Ionic Serve doesn't support the SDK and some of the other plugins, and I need to run it in an Emulator. In this case - Android emulator.
I am new to Android Studio, can somebody guide me on how to put logs into the JavaScript/TypeScript code and view it in log (Logcat? Or anywhere else). I just want to understand the debugging and logging mechanism here.
Anything that is written to the browser's debugging console should be displayed in the Android logs, e.g. console.log('Hello log!') or console.error('Is broke!')
See Console for more info on using the console.

Adding Cordova Platforms

Hey, Guys! I recently started to work with Cordova and when I run the Cordova platform add android i get the following error. I have successfully placed the environment variables for Java and for the Android SDK as well. But the npm modules does not exist in C:/Windows/System32/npm as shown in the error, It is in the Users/My username/AppData/Roaming/npm folder. Some guidance would be appreciated.
I followed the following scripts which are shown in the official Cordova documentation to create a new project.
Cordova create hello com.example.hello HelloWorld
cd hello
Cordova platform add android -> where I'm stuck at
Kindly Check the Android Version Provided by Cordova and verify with your current Android version installed on your system , if there a mismatch :
1) Update Android Version From Android Studio SDK Manager
2) Update Cordova Platform - Refer: Cordova Documentation
External Source
cordova - Error: Failed to fetch platform android
I figured out halfway what the the problem was. There was a file named 'npm' in my C:/Windows/System32 directory wich was of 0kb size, and once i deleted it, the error vanished. But not all the way though. I was able to install the browser platform but not the android platform via cordova platform add android or even specifying what the matching cordova-andriod pluggin to be with cordova platform add andriod#version.
Only through the cordova platform add https://github.com/apache/cordova-android.git script I could install the andriod platform and once it was done other steps worked fine, and the project ran through the Android AVD. Any idea why the normal command to add the android platform didnt work, Just want to know but if it happens again i think Im gonna have to run the get from git command again. Thanks

How to fix the issue in running my NativeScript app in android?

I typed : tns run android in the terminal and the default emulator API23 popsout but it did not install my app instead I got an error as stated below.Unlike when i run it in IOS simulator which runs without any error.
Cannot run your app in the native emulator. Increase the timeout of
the operation with the --timeout option or try to restart your adb
server with 'adb kill-server' command. Alternatively, run the Android
Virtual Device manager and increase the allocated RAM for the virtual
device.
Any help would be appreciated? Thanks!
Yes! I just solved my issue by downloading emulator in my Android
Virtual Device Manager. And I run my Nativescript application in
android. It worked. If you have the same problem I stated above,
please check in your Android Virtual Device Manager if you haven't
downloaded emulator first. Make sure you download the latest emulator.

console.log PhoneGap 3.1 on Android

I try to use console.log in my Phonegap 3.1 application.
I installed the console plugin, doing this:
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
Unfortunately when I examined the source of the plugin there are no src files for Android... should there be some.
My console.log still doesn't appear in ADB LogCat.
Thansk for any help,
ToM

Categories

Resources