IBM工作灯 - 我怎么能在Android中的WebView调试? [英] IBM Worklight - How do I enable WebView debugging in Android?

查看:137
本文介绍了IBM工作灯 - 我怎么能在Android中的WebView调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于Chrome浏览器进行远程调试一个真棒功能, 我想知道这到底是怎么在工作灯发展的帮助。

在他们说你的WebView内容调试下面的文档,你需要通过调用setWebContentsDebuggingEnabled,在web视图类的静态方法,使其能够编程方式从您的应用程序中。

我在哪里可以找到这个类,并会在有利于做到在工作灯?

<一个href="https://developers.google.com/chrome-developer-tools/docs/remote-debugging?hl=nl#debugging-webviews" rel="nofollow">https://developers.google.com/chrome-developer-tools/docs/remote-debugging?hl=nl#debugging-webviews

解决方案

请注意的WebView调试只与Android 4.4系统的奇巧而不是Android操作系统的任何早期版本。

要在一个工作灯的应用程序的Andr​​oid环境中调试铬的WebView,

  1. 打开Android SDK和更新的API级别19

    • 您当然会需要或者设备或模拟器上运行该版本。

  2. 确认,在 yourAppName \机器人\本地\ AndroidManifest.xml中添加了 targetSdkVersion = 19

      

    &LT;使用-SDK安卓的minSdkVersion =10机器人:targetSdkVersion =19/&GT;

  3. 更​​改构建目标为 Android 4.4系统

    • 右键单击生成的Andr​​oid项目>属性>安卓>构建目标

  4. 打开 yourAppName \机器人\本地的\ src \ COM \ yourAppName \ yourAppName.java

    • 导入以下内容:

     进口android.os.Build;
    进口android.util.Log;
    进口android.content.pm.ApplicationInfo;
    进口android.webkit.WebView;
     

    • 添加以下到的onCreate()功能:

     如果(Build.VERSION.SDK_INT&GT; = Build.VERSION_ codeS.KITKAT){
         如果(0!=(getApplicationInfo()标志= ApplicationInfo.FLAG_DEBUGGABLE)){
             WebView.setWebContentsDebuggingEnabled(真正的);
         }
    }
     

的步骤的其余部分是如在Google文档页面。

我没有Android设备,以验证这一点,所以请尽量。

至于是否有益与否,另一调试备选不能伤害。它是由你来决定,如果它是好还是不好,对你。

Since Chrome has an awesome feature for remote debugging, I am wondering how this could help in developing in Worklight.

In the following docs they say to debug the contents of your WebView, you need to enable it programmatically from within your application by calling setWebContentsDebuggingEnabled, a static method on the WebView class.

Where can I find this class and will this be beneficial to do it in Worklight?

https://developers.google.com/chrome-developer-tools/docs/remote-debugging?hl=nl#debugging-webviews

解决方案

Please note that WebView debugging is only relevant for Android 4.4 "KitKat" and not to any prior version of the Android OS.

To debug your Chromium WebView in a Worklight application with the Android environment,

  1. Open the Android SDK and update to API Level 19.

    • You will of course need either a device or emulator running this version.

  2. Make sure that in yourAppName\android\native\AndroidManifest.xml you add support for targetSdkVersion=19.

    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />

  3. Change the Build Target to Android 4.4:

    • Right-click on the generated Android project > Properties > Android > Build Target

  4. Open yourAppName\android\native\src\com\yourAppName\yourAppName.java and

    • Import the following:

    import android.os.Build;
    import android.util.Log;
    import android.content.pm.ApplicationInfo;
    import android.webkit.WebView;
    

    • Add the following to the onCreate() function:

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
         if(0 != (getApplicationInfo().flags = ApplicationInfo.FLAG_DEBUGGABLE)){
             WebView.setWebContentsDebuggingEnabled(true);
         }
    }
    

The rest of the steps are as described in the Google documentation page.

I don't have an Android device to verify this, so please try.

As for whether it is beneficial or not, another debugging alternative can't hurt. It is up to you to decide if it's good or not, for you.

这篇关于IBM工作灯 - 我怎么能在Android中的WebView调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆