Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android 4.4.2中的webview冻结_Android_Html_Android Webview - Fatal编程技术网

android 4.4.2中的webview冻结

android 4.4.2中的webview冻结,android,html,android-webview,Android,Html,Android Webview,我有一个应用程序,我正在用url在活动中加载webview 还有一个抽屉 这就是安卓4.4.2中的冻结 ,这在android 5.0和6.0以后的版本中运行良好 根据android监视器日志,冻结案例如下 ,则每次打字或触摸都会重复该日志 I/View:点击发送到android.webkit.WebView{42841ec0 VFED..C..F..0,0-480666#7f100075应用程序:id/web_view},事件= MotionEvent{action=action_DOWN,i

我有一个应用程序,我正在用url在活动中加载webview 还有一个抽屉 这就是安卓4.4.2中的冻结 ,这在android 5.0和6.0以后的版本中运行良好

根据android监视器日志,冻结案例如下 ,则每次打字或触摸都会重复该日志

  • I/View:点击发送到android.webkit.WebView{42841ec0 VFED..C..F..0,0-480666#7f100075应用程序:id/web_view},事件= MotionEvent{action=action_DOWN,id[0]=0,x[0]=248.48233, y[0]=327.48773,工具类型[0]=工具类型手指,按钮状态=0, metaState=0,flags=0x0,edgeFlags=0x0,pointerCount=1,historySize=0, eventTime=20907060,downTime=20907060,deviceId=3,source=0x1002}
    • D/VelocityTracker:无法打开“/dev/touch”(权限被拒绝)
    • D/VelocityTracker:tpd读取x失败:错误的文件号
    • D/VelocityTracker:tpd读取y失败:错误的文件号
    • I/View:修改发送到android.webkit.WebView{42841ec0 VFED..C。 .F…0,0-480666#7f100075应用程序:id/web_view},event=MotionEvent{ action=action\u UP,id[0]=0,x[0]=248.48233,y[0]=327.48773, toolType[0]=工具类型指针,按钮状态=0,元状态=0,标志=0x0, edgeFlags=0x0,pointerCount=1,historySize=0,eventTime=20907129, 停机时间=20907060,设备ID=3,源=0x1002}
我将webview属性设置为

webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setPluginState(PluginState.ON);
    webView.getSettings().setRenderPriority(RenderPriority.HIGH);
    webView.getSettings().setGeolocationEnabled(true);
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.getSettings().setAllowFileAccess(true);
我设置了网络客户端

webView.setWebChromeClient(new WebChromeClient() {            
@凌驾 公共布尔onShowFileChooser(WebView WebView、ValueCallback filePathCallback、FileChooseParams FileChooseParams){ 返回true; } @凌驾 public void onGeolocationPermissionsShowPrompt(字符串来源,GeolocationPermissions.Callback) { callback.invoke(origin、true、false); } //适用于Android 3.0的openFileChooser+ public void openFileChooser(ValueCallback uploadMsg,String acceptType){ } //适用于Android<3.0的openFileChooser public void openFileChooser(ValueCallback uploadMsg){ } //其他Android版本的openFileChooser public void openFileChooser(ValueCallback uploadMsg, 字符串接受类型, 字符串捕获){ openFileChooser(uploadMsg,acceptType); } 公共布尔onConsoleMessage(ConsoleMessage cm){ OnConsolleMessage(cm.message(),cm.lineNumber(),cm.sourceId()); 返回true; } 公共void OnConsolleMessage(字符串消息、整数行号、字符串源ID){ } }); // 结束设置WebChromeClient

    webView.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return true;
        }
        @Override

        public void onPageFinished(WebView view, final String url) {

            super.onPageFinished(view, url);
            CookieSyncManager.getInstance().sync();
            Log.i("finished", url);
        }
    });
这是我的xml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/layMain"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    tools:context=".LandingActivity">

    <WebView
        android:id="@+id/web_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/include"
        android:scrollbarStyle="insideOverlay"
        android:scrollbars="none"
        android:visibility="gone" />
    <ImageView
        android:id="@+id/splash"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:src="@drawable/splash"
        android:visibility="gone" />
    <include
        android:id="@+id/include"
        layout="@layout/bottom_option"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" />
    <FrameLayout
        android:id="@+id/framLay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone">
    </FrameLayout>
</RelativeLayout>
<LinearLayout
    android:layout_width="300dp"
    android:layout_height="fill_parent"
    android:layout_gravity="end"
    android:background="@color/white"
    android:orientation="vertical">
    <ListView
        android:id="@+id/navdrawer"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:background="@android:color/white"
        android:choiceMode="singleChoice"
        android:drawSelectorOnTop="false"></ListView>
    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_marginBottom="2dp"
        android:layout_marginTop="2dp"
        android:background="#454545" />
    <ListView
        android:id="@+id/navdrawer2"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:choiceMode="singleChoice"
        android:drawSelectorOnTop="false"></ListView>
    <TextView
        android:id="@+id/tvVersion"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="1dp"
        android:gravity="center" />
    <include layout="@layout/listview_bottom" />
</LinearLayout>


3.0.0及以上版本的Gradle和以上版本的编译器DK26会导致此问题

我的解不是精确解,但它解决了问题。。。 将应用程序渐变切换到

classpath 'com.android.tools.build:gradle:2.3.0'
compileSdkVersion 25
buildToolsVersion '25.0.2'
开关模块渐变至

classpath 'com.android.tools.build:gradle:2.3.0'
compileSdkVersion 25
buildToolsVersion '25.0.2'
将所有其他api更改为max 25将解决frezee问题。。在主要解决方案出现之前,改变这些事情是值得的


看来“Kotlin”并不像预期的那样。。。导致CPU的更多工作

即使在刷新webview之后仍然无法工作需要帮助您有任何解决方案吗?还没有,我的开发仍然存在这个问题。我使用的是Xwalk,切换到android webview,出现了这个问题