通過adb從PC調試Android WebView

[英]Debugging an Android WebView from the PC via adb


I have just recently started android development. I'm actually building a Web application that runs off an Android WebView. So, I'd like to know if there is any way to debug the web application (js,css,html) from the PC via the ADB or anything. I Googled it and got options but none have an extensive debugging facility like firebug. So, any ideas would be greatly appreciated. Thanks in advance.

我剛剛開始進行android開發。我實際上正在構建一個運行Android WebView的Web應用程序。所以,我想知道是否有任何方法可以通過ADB或其他方式從PC調試Web應用程序(js,css,html)。我用Google搜索並獲得了選項,但沒有一個像firebug那樣有廣泛的調試工具。所以,任何想法將不勝感激。提前致謝。

1 个解决方案

#1


0  

Since Android 4.2 (if i'm not mistaking the version) you can:

從Android 4.2開始(如果我沒有誤解版本)你可以:

  1. turn on development mode on your phone
  2. 打開手機上的開發模式
  3. connect it via USB cable to your PC
  4. 通過USB線將其連接到PC
  5. make sure to "Trust this computer" on the tablet/phone
  6. 確保在平板電腦/手機上“信任此計算機”
  7. go to chrome://inspect on your PC in Google Chrome, you should see your device and the pages that are open on it.
  8. 轉到chrome://在Google Chrome中檢查您的PC,您應該會看到您的設備及其上打開的頁面。
  9. clicking one of the links will pop up an inspector for the respective page on the device, complete with inspect element, console, networking and everything else the Chrome inspector has.
  10. 單擊其中一個鏈接將彈出設備上相應頁面的檢查器,其中包括檢查元素,控制台,網絡以及Chrome檢查器所具有的所有其他內容。

This is how i debug my app on a Nexus 7 tablet. If your device is running an older version of Android, there's little you can do apart from console.log's and tediously finding them through an adb logcat.

這是我在Nexus 7平板電腦上調試我的應用程序的方式。如果您的設備運行的是舊版本的Android,除了console.log之外幾乎沒有什么可以做的,並且通過adb logcat繁瑣地找到它們。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/09/16/724e86606db5449df9ae9be5189efe74.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com