Android Webview does not return website content

Asked

Viewed 155 times

0

I try to run the application below without success. The returned error informs that the site does not respond, which may be?

Mainactivity.java and logcat. Thank you in advance for your attention.

package com.mycompany.TesteWebView;

import android.app.*;
import android.os.*;
import android.webkit.*;

public class MainActivity extends Activity 
{   
@Override
   protected void onCreate(Bundle         savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

WebView myWebView = (WebView)      findViewById(R.id.webview);
  WebSettings webSettings =      myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
 myWebView.loadUrl("http://www.google.com.uk");
             }
    }

log:

Late-enabling -Xcheck:jni
04-02 21:13:16.682 23877 23877 W        System                                       ClassLoader      referenced unknown path:      /data/app/com.mycompany.TesteWebView-2/lib/arm
 04-02 21:13:25.541 23877 23877 I   WebViewFactory                               Loading com.google.android.webview version 56.0.2924.87 (code 292408700)
 04-02 21:13:25.696 23877 23877 I   art                                          Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
 04-02 21:13:25.697 23877 23877 I   art                                          Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
04-02 21:13:25.704 23877 23877 I   art                                          Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
04-02 21:13:25.705 23877 23877 I   art                                          Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
04-02 21:13:25.718 23877 23877 I   cr_LibraryLoader                             Time to load native libraries: 2 ms (timestamps 2997-2999)
04-02 21:13:25.718 23877 23877 I   cr_LibraryLoader                             Expected native library version number "56.0.2924.87", actual native library version number "56.0.2924.87"
 04-02 21:13:25.760 23877 23877 I   cr_LibraryLoader                             Expected native library version number "56.0.2924.87", actual native library version number "56.0.2924.87"
 04-02 21:13:25.763 23877 23877 I   chromium                                     [INFO:library_loader_hooks.cc(163)] Chromium logging enabled: level = 0, default verbosity = 0
04-02 21:13:25.779 23877 23877 I   cr_BrowserStartup                            Initializing chromium process, singleProcess=true
04-02 21:13:25.814 23877 23877 I   Adreno-EGL                                   <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/09/15, 6cbbf7d, I3193f6e94a
 04-02 21:13:26.183 23877 23877 I   cr_Ime                                       ImeThread is enabled.
04-02 21:13:26.202 23877 24117 W   cr_media                                     Requires BLUETOOTH permission
04-02 21:13:26.255 23877 24122 D   OpenGLRenderer                               Use EGL_SWAP_BEHAVIOR_PRESERVED: true
 04-02 21:13:26.367 23877 24122 I   OpenGLRenderer                               Initialized EGL, version 1.4
 04-02 21:13:26.750 23877 24142 E   libEGL                                       validate_display:255 error 3008 (EGL_BAD_DISPLAY)
 04-02 21:13:26.875 23877 24142 W   VideoCapabilities                            Unrecognized profile 2130706433 for video/avc
 04-02 21:13:26.902 23877 24142 W   VideoCapabilities                            Unrecognized profile/level 0/3 for video/mpeg2
 04-02 21:13:26.952 23877 24142 I   VideoCapabilities                            Unsupported profile 4 for video/mp4v-es
04-02 21:13:27.023 23877 23877 W   cr_BindingManager                            Cannot call determinedVisibility() - never saw a connection for the pid: 23877
04-02 21:13:27.036 23877 23877 W   cr_BindingManager                            Cannot call determinedVisibility() - never saw a connection for the pid: 23877
04-02 21:13:33.536 23877 24122 E   Surface                                      getSlotFromBufferLocked: unknown buffer: 0xb8f77c70

(https://i.stack.Imgur.com/qObvb.png)

  • Granted permission on Androidmanifest?

  • 1

    Hello Ack Lay, I granted the permission but I think in the wrong place. I was inside the application tag. I rewrote out the tag and it worked. Thank you.

1 answer

0

Check the following items:

  • Internet permission on Androidmanifest.xml (<uses-permission android:name="android.permission.INTERNET" />)
  • Site actually exists.

I did a test with the site you are trying to access: www.google.com.uk, but it is not even accessible in the browser. Audition with www.google.com.

  • 1

    Thank you Carlos, I migrated the uses-permition out of the application tag and changed the address to (http://www.google.com) and it worked! It turns out that the method opens an instance of the browser, but what I need is to interact with the site. Read the code of the site is to submit data as if it were a human. Can you guide me on how to do it? Should I open another topic?

  • @Ultraseven Yes, open a new question, then we can give you examples in another answer ;)

Browser other questions tagged

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