简体   繁体   English

如何在 Android-Phonegap-app 中获取浏览器控制台错误,可能在 Eclipse 中?

[英]How to get browser console errors in Android-Phonegap-app, possibly in Eclipse?

I have PhoneGap app running in Android.我有在 Android 中运行的 PhoneGap 应用程序。 I need to see the browser log (not just the console.log()) so that I could see all the errors and possibly warnings.我需要查看浏览器日志(不仅仅是 console.log()),这样我才能看到所有错误和可能的警告。 I am aware of this similar question , however, that doesn't solve my problem, because it deals only with console.log().我知道这个类似的问题,但是,这并不能解决我的问题,因为它只处理 console.log()。 My app is crashing in Android 1.6 browser and I need to see why.我的应用程序在 Android 1.6 浏览器中崩溃,我需要了解原因。 There is probably some syntax detail, which all newer Android browsers don't mind, but 1.6 is probably complaining about something and I need to see what.可能有一些语法细节,所有较新的 Android 浏览器都不介意,但 1.6 可能在抱怨什么,我需要看看。

I am using Eclipse, so if it is possible to use it to see browser error console, it would be great.我正在使用 Eclipse,所以如果可以使用它来查看浏览器错误控制台,那就太好了。 I am also aware of LogCat tool in Eclipse, but it doesn't show any output from PhoneGap internal browser at all.我也知道 Eclipse 中的 LogCat 工具,但它根本没有显示来自 PhoneGap 内部浏览器的任何 output。 Please help, I am lost;-)请帮忙,我迷路了;-)

As of Phonegap 1.6 (Cordova), you can get console.log by watching the output from LogCat for the tag CordovaLog.从 Phonegap 1.6 (Cordova) 开始,您可以通过查看来自 LogCat 的标签 CordovaLog 的 output 来获取 console.log。 If you are using Eclipse, you can add a new filter for phone gap logs.如果您使用的是 Eclipse,则可以为电话间隙日志添加新过滤器。 Just click the plus sign, choose whatever you want in the Filter name field and make sure to add: CordovaLog in the by Log Tag field.只需单击加号,在 Filter name 字段中选择您想要的任何内容,并确保在 by Log Tag 字段中添加: CordovaLog

I'm afraid I don't think it's possible.恐怕我不认为这是可能的。 I've certainly not been able to find a way of doing it as of yet.到目前为止,我当然还没有找到一种方法。

I debug the JavaScript of my PhoneGap web applications by running them first in Chrome and stepping through the JS debugger.我首先在 Chrome 中运行它们并逐步通过 JS 调试器来调试我的 PhoneGap web 应用程序的 JavaScript。 If you're not dependent on native API calls then this is probably the best method.如果您不依赖本机 API 调用,那么这可能是最好的方法。

Please let me know if you find a better method.如果您找到更好的方法,请告诉我。

Here's a reliable source that backs up what I've said: http://www.phonegap.com/2011/05/18/debugging-phonegap-javascript/这是支持我所说的可靠来源: http://www.phonegap.com/2011/05/18/debugging-phonegap-javascript/

EDIT: I just found this https://chrome.google.com/webstore/detail/geelfhphabnejjhdalkjhgipohgpdnoc#编辑:我刚刚发现这个https://chrome.google.com/webstore/detail/geelfhphabnejjhdalkjhgipohgpdnoc#

Looks like an excellent tool for what we are after.看起来是我们所追求的一个很好的工具。 I'm going to try it out now.我现在要试一试。

This is the tool that I use.这是我使用的工具。 Very handy and you can see a lot more then just console messages.非常方便,您可以看到更多内容,而不仅仅是控制台消息。 You can interact with the mobile device (also PhoneGap apps) like chrome developer tools.您可以与移动设备(也包括 PhoneGap 应用程序)进行交互,例如 chrome 开发者工具。 I also think it is much better then Ripple.我也认为它比 Ripple 好得多。 Debugging on the real device is always better!在真机上调试总是更好!

http://debug.phonegap.com/ http://debug.phonegap.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM