有没有一种适用于 Android 的 Firebug 或 JavaScript 控制台调试?
我正在开发一个移动网站。它适用于 Firefox 桌面版。它可以在 iPhone 上运行,但当我在 Android 2.x(可能更低)上按下按钮时。 我的 JavaScript 代码崩溃了或者其他什么...
我可以访问这些设备的记录器或 JavaScript 控制台吗?
更好的应该是一种Firebug应用程序。
I'm developing a website for mobile. It works on Firefox desktop. It works on iPhone, but when I press a buton on Android 2.x (and maybe lower).
my JavaScript code crashes or what else...
Can I get access to the logger or JavaScript console for those devices?
The better should be a kind of Firebug application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
一种选择是 weinre。它提供了 DOM 和与控制台一起进行样式编辑。如果您不想自己设置,可以在 http://debug.phonegap.com
另一个选项是 JSHybugger。它无疑是适用于 Android 浏览器的最完整的调试环境。这是一个付费产品,但可能值得。
One option is weinre. It provides DOM & Style editing along with the console. If you don't want to set it up yourself, there is an instance hosted at http://debug.phonegap.com
The other option is JSHybugger. It's certainly the most complete debugging environment available for android browser. It's a paid product, but probably worth it.
Chrome 有一个非常好的功能,称为“USB Web 调试”,它允许在通过 USB 连接时在 PC 上查看移动设备的调试控制台。
请参阅此处了解更多详细信息。
编辑:Windows 似乎不支持 ADB 8,但此链接似乎提供了一个解决方案:
http://mikemurko.com/general/chrome-remote-debugging-nexus-7-on-windows-8/
Chrome has a very nice feature called 'USB Web debugging' which allows to see the mobile device's debug console on your PC when connected via USB.
See here for more details.
EDIT: Seems that the ADB is not supported on Windows 8, but this link seems to provide a solution:
http://mikemurko.com/general/chrome-remote-debugging-nexus-7-on-windows-8/
您可以在某些移动浏览器中输入
about:debug
来启动 JavaScript 控制台。You can type
about:debug
in some of the mobile browsers to pull up a JavaScript console.我有时将调试输出打印到浏览器窗口。使用jQuery,您可以将输出消息发送到页面上的显示区域:
或者如果您想监视 JavaScript 变量而不向页面添加显示区域:
I sometimes print debugging output to the browser window. Using jQuery, you could send output messages to a display area on your page:
Or if you want to watch JavaScript variables without adding a display area to your page:
我有同样的问题,只需使用
console.log(... )
(如 firebug),并安装日志查看器应用程序,这将允许您查看浏览器的所有日志。I had the same problem, just use
console.log(...)
(like firebug), and the install a log viewer application, this will allow you to view all the logs for your browser.我们在项目中按照以下步骤在移动设备上调试网站。
We are following the below steps in our project for debugging a website on mobile.
您可以尝试 YConsole 一个 js 嵌入式控制台。它重量轻且使用简单。
使用方法:
You can try YConsole a js embedded console. It is lightweight and simple to use.
How to use :
“USB Web 调试”是一个选项,
“将其打印在屏幕上”是另一个选项。
但我更喜欢通过“adobe edgespect”进行远程调试,正式名称为 adobe 阴影。它在内部使用 weinre (=WEb INspect REmote)
你只需安装它 +浏览器 (Chrome) 中的一个小插件和一个可以在 Play 商店下载的免费应用程序。然后您就拥有了所有工具,例如 Chrome 开发工具。
它还支持 iOS 和 Kindle Fire
更新
就像 Chris 注意到的那样,您必须付费订阅才能使用边缘检查。一个廉价的替代方案是直接使用 weinre,它是边缘检查的基础。 这里有一篇文章介绍如何设置它向上。
"USB Web debugging" is one option
"printing it on the screen" another.
But I prefer remote debugging through 'adobe edge inspect' formally known as adobe shadow. It uses weinre internally (=WEb INspect REmote)
You just install it + a small plugin in the browser (Chrome) and a free app you can download in the play-store. Then you have all the tools like the Chrome Development tools.
It has also support for iOS and Kindle Fire
Update
Like Chris noticed, you have to pay a subscription to use edge inspect. A cheap alternative is to use weinre directly, it's the base of edge inspect. Here's an article about how to set it up.
如果您使用 Cordova 3.3 或更高版本,并且您的设备运行 Android 4.4 或更高版本,则可以使用“通过 Chrome 在 Android 上进行远程调试”。完整说明如下:
https://developer.chrome.com/devtools/docs/remote-调试
总结:
或者,如果您使用 Cordova 3.3+ 并且没有 4.4 的物理设备,您可以使用 Android 4.4+ 的模拟器通过模拟器运行应用程序,在您的设备上台式电脑。
If you're using Cordova 3.3 or higher and your device is running Android 4.4 or higher you can use 'Remote Debugging on Android with Chrome'. Full instructions are here:
https://developer.chrome.com/devtools/docs/remote-debugging
In summary:
Or, if you're using Cordova 3.3+ and don't have a physical device with 4.4, you can use an emulator that uses Android 4.4+ to run the application through the emulator, on your desktop computer.
如果您不介意通过第 3 方服务器转发,JSConsole 是一个相当有用的 JavaScript 远程调试器。
If you don't mind forwarding through a 3rd party server, JSConsole is a rather useful remote debugger for JavaScript.
我最近编写了一个工具,用于在可移动/可调整大小的“窗口”(实际上是一个 div)中显示控制台日志。它提供与 Firebug 控制台类似的功能,但您可以在平板电脑上的页面上看到它。 平板电脑/智能手机/Phablet 调试控制台
I have recently written a tool for showing console logs in a movable/resizable "window" (actually a div). It provides similar functionality to Firebug's console but you can see it over your page on a tablet. Tablet/Smartphone/Phablet Debug Console
我还寻找一个简单的控制台替代品,只是为了转储文本。所以我所做的就是这个函数:
远程 PHP 文件将所有输出记录到
arg
中的数据库中。我花了 5 分钟(好吧,在服务器端我使用了一个简单的日志库来记录和显示文本消息,但仍然......)。I also looked for a simple console replacement, just to dump text. So what I did was this function:
The remote PHP file recorded all the output to a database in
arg
. It took me 5 minutes (OK, on the server side I used a simple logging library that records and displays text messages, but still...).2013 年 12 月 3 日,Google 推出了适用于移动设备的 Chrome DevTools,让开发者能够通过仿真和屏幕投射以及零配置来远程调试移动网络应用程序。
如需了解所有功能,请查看 Paul Irish 在 YouTube 上的演讲。
On 2013-12-03 Google launched Chrome DevTools for Mobile, which lets developers remote debug mobile web applications via emulation and screen-casting with Zero Configuration.
For all features, checkout Paul Irish's talk on YouTube.
尝试 js-mobile-console
MobileConsole 可以嵌入到任何页面中进行调试。它将捕获错误并表现得与浏览器中的本机 JavaScript 控制台完全相同。它还通过 window.console 的 API 输出您编写的所有日志。
Try js-mobile-console
MobileConsole can be embedded within any page for debugging. It will catch errors and behave exactly as the native JavaScript console in the browser. It also outputs all the logs you've written via an API of window.console.