首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >棉花糖上的WebView错误

棉花糖上的WebView错误
EN

Stack Overflow用户
提问于 2018-02-15 21:19:08
回答 1查看 1.4K关注 0票数 1

我正在测试我的应用程序,当我打开一个带有视频播放器(X网页)的WebView时,它崩溃了……我得到以下错误:

(平板电脑,1 GB Ram,带S.O棉花糖6.0.1 )

代码语言:javascript
复制
W/cr_media: Requires BLUETOOTH permission
D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor
W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring
D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
I/cr_Ime: ImeThread is not enabled.
I/Choreographer: Skipped 40 frames!  The application may be doing too much work on its main thread.
E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 2137
D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
I/chromium: [INFO:CONSOLE(0)] "Deferred long-running timer task(s) to improve scrolling smoothness. See crbug.com/574343.", source: "Here is the link of player"(0)
D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: true
D/cr_Ime: [InputMethodManagerWrapper.java:68] hideSoftInputFromWindow
A/chromium: [FATAL:memory.cc(19)] Out of memory. size=316362752
W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
W/google-breakpad: Chrome build fingerprint:
W/google-breakpad: 1.0
W/google-breakpad: 1
W/google-breakpad: 609e4c8b-a10e-4de4-8770-d4fbd1c9b36d
W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 2229 (CompositorTileW)
Application terminated.

有时页面打开没有问题,但当我要在视频中按播放时,它再次崩溃。

有人知道这个问题是什么吗?可能只是内存不足?...webView在4.4.2 (三星S4) - 5.1 (Moto G)和7.0 (S7 Edge) S.O中工作正常,谢谢。

编辑:ExploraVideos活动代码

代码语言:javascript
复制
public class ExploraVideos extends Activity {
    String ShowOrHideWebViewInitialUse = "show";
    private WebView webview ;
    private ProgressBar spinner;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.activity_videos);

    webview =(WebView)findViewById(R.id.webView);
    spinner = (ProgressBar)findViewById(R.id.progressBar1);
    webview.setWebViewClient(new CustomWebViewClient());

    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setDomStorageEnabled(true);
    webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
    webview.loadUrl("here is the link of player");
}

/*This allows for a splash screen (and hide elements once the page loads)*/
private class CustomWebViewClient extends WebViewClient {

    @Override
    public void onPageStarted(WebView webview, String url, Bitmap favicon) {
        // only make it invisible the FIRST time the app is run
        if (ShowOrHideWebViewInitialUse.equals("show")) {
            webview.setVisibility(webview.INVISIBLE);
        }
    }

    @Override
    public void onPageFinished(WebView view, String url) {

        ShowOrHideWebViewInitialUse = "hide";
        spinner.setVisibility(View.GONE);

        view.setVisibility(webview.VISIBLE);
        super.onPageFinished(view, url);
    }
}

@Override
protected void onStop() {
    super.onStop();
    onDestroy();
}

}
EN

回答 1

Stack Overflow用户

发布于 2018-04-03 05:24:34

尝试使用ExoPlayer以避免内存不足:或尝试执行以下操作:

webview.loadDataWithBaseURL(url,data,"text/html","UTF-8",url);

这似乎已经解决了高cpu使用率和内存泄漏问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48808261

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档