loadUrl finishes (crash) the app on Android

Asked

Viewed 131 times

3

When using WebView.loadUrl(url); on Android or in some versions of Android the application finishes alone ("crash"), in case the failure occurred in versions 6 and 7 of Android.

Notes:

  • The Host GPU is enabled on emulators
  • The problem occurs in cell phones too

The only way the problem did not occur was disable hardware acceleration like this:

<activity android:hardwareAccelerated="false" />

But this makes the application’s performance worse, I would like to use the acceleration and "prevent" the error from occurring.

I added the permissions (this is because minSdk is 19):

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.guilherme.webviewexample">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

The build.gradle is like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

...

And the code like this:

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

    myWebView  = (WebView) findViewById(R.id.myWebView);

    WebViewClient clientInterface = new WebViewClient();

    WebView myWebView = (WebView) findViewById(R.id.myWebView);

    WebSettings wbset = myWebView.getSettings();
    wbset.setJavaScriptEnabled(true);
    myWebView.setWebViewClient(clientInterface);

    String url = "http://answall.com";

    myWebView.loadUrl(url);
}

I believe the mistake is this:

Gles2decoderimpl::Resizeoffscreenframebuffer failed to allocate Storage for Offscreen target Depth buffer.

Follow the LOG at the time of the crash:

11-10 10:52:13.779 22603-22603/com.example.guilherme.webviewexample I/chromium: [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
11-10 10:52:13.809 22603-22603/com.example.guilherme.webviewexample E/chromium: [ERROR:gles2_cmd_decoder.cc(3389)] GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed to allocate storage for offscreen target depth buffer.
11-10 10:52:13.809 22603-22603/com.example.guilherme.webviewexample E/chromium: [ERROR:gles2_cmd_decoder.cc(2433)] Could not allocate offscreen buffer storage.
11-10 10:52:13.809 22603-22603/com.example.guilherme.webviewexample E/chromium: [ERROR:in_process_command_buffer.cc(465)] Could not initialize decoder.
11-10 10:52:13.809 22603-22603/com.example.guilherme.webviewexample A/libc: Fatal signal 11 (SIGSEGV) at 0x00000048 (code=1), thread 22603 (.webviewexample)
  • Caraca, I ran exactly the same code here and rolled well, a Clean Project will not help?

  • @Leonardodias I created a project from scratch and it still didn’t work out :/ ... maybe it’s something with my IDE or compiler, I don’t know if it makes a difference, but before I used Windows8 now I’m using Windows7

  • Well...from what I read, the webview of the devices must be outdated (I may be wrong). When the permissions in real time, give a read here...https://developer.android.com/training/permissions/requesting.html It is quiet to touch it.

  • @Guillhermenascimento see if this question helping, apparently Webview is not properly destroyed at the end of the application.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.