{"id":2722,"date":"2012-08-23T20:35:51","date_gmt":"2012-08-23T18:35:51","guid":{"rendered":"http:\/\/glandium.org\/blog\/?p=2722"},"modified":"2019-09-03T15:30:34","modified_gmt":"2019-09-03T06:30:34","slug":"android-debug-bridge-for-firefox","status":"publish","type":"post","link":"https:\/\/glandium.org\/blog\/?p=2722","title":{"rendered":"Android Debug Bridge for Firefox"},"content":{"rendered":"<p>I uploaded an experimental add-on on AMO that adds <a href=\"https:\/\/addons.mozilla.org\/en-US\/firefox\/addon\/android-debug-bridge-for-fi\/\">some kind of support for the Android Debug Bridge<\/a> to Firefox. It requires the <code>adb<\/code>\/<code>adb.exe<\/code> executable from the Android SDK. <b>Disclaimer<\/b>: the add-on is experimental and is known to leak small amounts of memory and have various problems handling errors. It's also <a href=\"https:\/\/github.com\/glandium\/adb4ff\">on github<\/a>, if you want to give a hand.<\/p>\n<p>The add-on provides three features.<\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2012\/08\/adb.png\" \/><\/p>\n<p>The first one is access to Android and Firefox OS devices filesystem through the <code>adb:\/\/<\/code> protocol. Without the serial number for any device, a list of connected devices is shown, like in the screenshot above. With a device serial number in the url (<code>adb:\/\/<i>serial<\/i>\/<\/code>), it shows filesystem contents, as below:<\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2012\/08\/adb-directory.png\" \/><\/p>\n<p>Please note the add-on doesn't work well with symbolic links at the moment.<\/p>\n<p>Another feature is the ability to grab the framebuffer on a device and display it as a PNG image. This feature is available through <code>adbview:\/\/<\/code> urls, and like <code>adb:\/\/<\/code>, a list of connected devices will be shown if no device serial is given.<\/p>\n<p>It can show a screen capture of Android devices:<br \/>\n<img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2012\/08\/adbview.png\" \/><\/p>\n<p>As well as Firefox OS devices:<br \/>\n<img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2012\/08\/adbview-b2g.png\" \/><\/p>\n<p>For Firefox OS devices, it requires <a href=\"https:\/\/github.com\/mozilla-b2g\/screencap-gonk\">a fork of the screencap tool<\/a>. It should be <a href=\"https:\/\/github.com\/mozilla-b2g\/b2g-manifest\/commit\/2901ddaed139ce9c2afeb7c0d23fd94941de90b3\">included<\/a> in recent Firefox OS builds.<\/p>\n<p>Finally, the add-on improves the <a href=\"http:\/\/starkravingfinkle.org\/blog\/2012\/08\/firefox-for-android-remote-debugging-is-here\/\">Remote Debugging feature included in Firefox<\/a>. As described on <a href=\"http:\/\/starkravingfinkle.org\/blog\/2012\/08\/firefox-for-android-remote-debugging-is-here\/\">Mark Finkle's blog<\/a>, you would normally type an <code>adb<\/code> command to forward a tcp port first. When you have several devices, that requires forwarding different local ports to port 6000 on each device, and remembering which is which.<\/p>\n<p>The addon allows to skip that step, and to connect through the Android Debug Bridge directly, without local port forwarding.<\/p>\n<p>Check out Mark's post for instructions to enable Remote Debugging on both the device and desktop.<\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2012\/08\/remote-debugger-adb.png\" \/><\/p>\n<p>The prompt shown when opening the Remote Debugger is augmented with a list of devices. <code>local<\/code> is the desktop machine running Firefox. The other items in the list are the connected Android or Firefox OS devices. This relies on monkey-patching Firefox Remote Debugger code, so this is not completely reliable, currently only works with a recent Firefox 17 nightly, and may break at any time in the future.<\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2012\/08\/remote-debugger-adb-select.png\" \/><\/p>\n<p>When you select a device, you shouldn't need to change the <code>host:port<\/code> field, but you could theoretically change it to access even more remote devices through the device's network.<\/p>\n<p>Once you selected a device in the Remote Debugger prompt, you get the usual prompt on the device itself:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2012\/08\/remote-debugger-prompt.png\" width=\"240\" height=\"400\" \/><\/p>\n<p>(By the way, the screenshot above was taken with <code>adbview:\/\/<\/code>)<\/p>\n<p>That brings up scripts running in the Firefox instance on the device:<\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2012\/08\/remote-debugger-view.png\" \/><\/p>\n<p>Thanks to the mobile team for having brought Remote Debugging.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I uploaded an experimental add-on on AMO that adds some kind of support for the Android Debug Bridge to Firefox. It requires the adb\/adb.exe executable from the Android SDK. Disclaimer: the add-on is experimental and is known to leak small amounts of memory and have various problems handling errors. It&#8217;s also on github, if you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[23],"class_list":["post-2722","post","type-post","status-publish","format-standard","hentry","category-planet-mozilla","tag-en"],"_links":{"self":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2722"}],"version-history":[{"count":26,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2722\/revisions"}],"predecessor-version":[{"id":3591,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2722\/revisions\/3591"}],"wp:attachment":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}