在Kindle Fire上運行我的網站時,我通過Chrome瀏覽器時遇到了一些不同的JavaScript行爲。爲了調試,我需要訪問Chrome Developer Tool或Firebug之類的東西。有什麼建議麼?如何在Kindle Fire上調試絲印瀏覽器?
5
A
回答
5
在這裏的同一條船...希望adb logcat會有幫助,但是JavaScript控制檯消息似乎並沒有出現在那裏。也許有些東西需要在設備上設置才能將控制檯日誌導向logcat?
編輯:找到一個體面的解決方案:http://jsconsole.com - 允許您設置遠程調試/日誌記錄控制檯。非常簡單(僅限控制檯日誌記錄,因此您需要將很多內容轉儲到日誌中)......但它運行良好。至少幫助我追蹤我的問題的根源!
0
我採取了不同的方法,並創建了一個彈出對JavaScript對話框的包裝機應用程序。
我的包裝代碼很大,所以我拿了一些相關的部分。它實際上工作,並會顯示任何JavaScript錯誤。
// registers the debugger to catch errors
WebView engine = (WebView) findViewById(R.id.web_engine);
engine.setWebChromeClient(new DebugClient(this));
// the class that manages the errors
private class DebugClient extends WebChromeClient {
Activity activity;
public DebugClient(Activity activity) {
this.activity = activity;
}
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
if (consoleMessage.messageLevel() == MessageLevel.ERROR
|| consoleMessage.messageLevel() == MessageLevel.WARNING) {
String title="Javascript error on line "
+ String.valueOf(consoleMessage.lineNumber())
+ " of " + consoleMessage.sourceId();
AlertBox alertBox=new AlertBox(activity, (ActionListener)null, title, consoleMessage.message(), "OK");
alertBox.show();
alertBoxes.add(alertBox);
}
return true;
}
}
要編譯這個,您需要在您的計算機上安裝Android SDK,並且可能需要在ADT上安裝Java IDE(Eclipse?)。然後,您只需執行以下操作:創建新項目,將WebView組件添加到layout/main.xml中,然後粘貼代碼。編譯並安裝在Kindle Fire上。
相關問題
- 1. Kindle Fire:內容瀏覽
- 2. Kindle Fire中的Webview瀏覽器
- 3. Kindle Fire USB調試模式
- 4. 如何在亞馬遜Kindle Fire上調試android應用程序?
- 5. 在Mac上安裝Kindle Fire
- 6. 如何在Mac上使用Eclipse在Amazon Kindle Fire上調試應用程序?
- 7. 有沒有辦法在Kindle Fire上進行USB調試?
- 8. Unity3D在Kindle Fire HD上運行時調試
- 9. 在Kindle Fire平臺上調試android應用程序
- 10. Kindle Fire上的Amazon Silk瀏覽器是否支持視口元標記?
- 11. Kindle Fire和文件上傳
- 12. kindle fire @media
- 13. Kindle Fire和GlSurfaceView.getHeight()
- 14. Kindle Fire權限
- 15. Kindle Fire minSdkVersion?
- 16. Kindle電子書瀏覽器上的UpdatePanel
- 17. App如何在Kindle上打開市場和/或瀏覽器
- 18. 如何在Amazon Fire Phone上調試webview?
- 19. 如何在瀏覽器中調試Dojo?
- 20. Android ListView不會在Kindle Fire上滾動
- 21. 在Kindle Fire上使用HDPI資源
- 22. Kindle fire,麥克風
- 23. 試圖在Kindle Fire上安裝APK的問題
- 24. kindle fire自定義url如何?
- 25. 如何打開Kindle Fire的〜/ .android/adb_usb.ini?
- 26. 如何調試SWF瀏覽器崩潰
- 27. 如何在kindle fire上運行Google地圖應用程序
- 28. 如何在Kindle Fire上安裝.apk文件
- 29. 訪問媒體庫上的Kindle Fire
- 30. APK Kindle Fire上的擴展文件
FWIW,我現在在需要時使用Weinre。 jsconsole很棒,但是weinre提供了和Chrome開發者工具條相同的調試工具。設置起來有點複雜,但值得:http://people.apache.org/~pmuellr/weinre/docs/latest/ – 2013-01-30 16:39:14