我正在测试我的应用,当我打开一个带有视频播放器(X网页)的WebView
时,它会崩溃...我收到以下错误:
(片剂,1 GB Ram with S.O Marshmallow 6.0.1)
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
活动代码
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();
}
}
答案 0 :(得分:0)
尝试使用ExoPlayer以避免内存不足: 或试试这个:
webview.loadDataWithBaseURL(url,data,"text/html","UTF-8",url);
这似乎修复了高CPU使用率和内存泄漏。