Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webview_flutter] Support settings.setDomStorageEnabled #26347

Closed
amsmu opened this issue Jan 10, 2019 · 27 comments
Closed

[webview_flutter] Support settings.setDomStorageEnabled #26347

amsmu opened this issue Jan 10, 2019 · 27 comments
Labels
c: crash Stack traces logged to the console p: webview The WebView plugin package flutter/packages repository. See also p: labels. platform-android Android applications specifically

Comments

@amsmu
Copy link

amsmu commented Jan 10, 2019

Steps to Reproduce

  1. Run webview_flutter example app with url: "https://kreatryx.com"
  2. On Android it just shows white screen. On iOS it runs fine.

Logs

I/chromium(19361): [INFO:CONSOLE(25)] "[Facebook Pixel] - An invalid email address was specified for 'em'. This data will not be sent with any events for this Pixel.", source: https://connect.facebook.net/en_US/fbevents.js (25)
I/chromium(19361): [INFO:CONSOLE(61)] "Uncaught TypeError: Cannot read property 'getItem' of null", source: https://www.kreatryx.com/app.4cb11855a0215a0feb1a.js (61)
I/chromium(19361): [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'getItem' of null", source: https://my.hellobar.com/modules-v42.js (1)
@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

Probably #25351 or #26272

Please add the output of flutter doctor -v
and the full error output.

To investigate we would need a minimal runnable reproduction
as a single file so that we can just copy your code into lib/main.dart of a new project and run to reproduce.

Please consider asking support questions in one of the other channels listed at http://flutter.io/support .

@zoechi zoechi added waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds c: crash Stack traces logged to the console plugin p: webview The WebView plugin labels Jan 10, 2019
@amsmu
Copy link
Author

amsmu commented Jan 10, 2019

Here's the main.dart

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(MaterialApp(home: WebViewExample()));

class WebViewExample extends StatelessWidget {
  final Completer<WebViewController> _controller =
      Completer<WebViewController>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter WebView example'),
        // This drop down menu demonstrates that Flutter widgets can be shown over the web view.
        actions: <Widget>[
          NavigationControls(_controller.future),
          SampleMenu(_controller.future),
        ],
      ),
      body: WebView(
        initialUrl: 'https://kreatryx.com',
        javascriptMode: JavascriptMode.unrestricted,
        onWebViewCreated: (WebViewController webViewController) {
          _controller.complete(webViewController);
        },
      ),
      floatingActionButton: favoriteButton(),
    );
  }

  Widget favoriteButton() {
    return FutureBuilder<WebViewController>(
        future: _controller.future,
        builder: (BuildContext context,
            AsyncSnapshot<WebViewController> controller) {
          if (controller.hasData) {
            return FloatingActionButton(
              onPressed: () async {
                final String url = await controller.data.currentUrl();
                Scaffold.of(context).showSnackBar(
                  SnackBar(content: Text("Favorited $url")),
                );
              },
              child: const Icon(Icons.favorite),
            );
          }
          return Container();
        });
  }
}

enum MenuOptions {
  evaluateJavascript,
  toast,
}

class SampleMenu extends StatelessWidget {
  SampleMenu(this.controller);
  final Future<WebViewController> controller;

  @override
  Widget build(BuildContext context) {
    return FutureBuilder<WebViewController>(
      future: controller,
      builder:
          (BuildContext context, AsyncSnapshot<WebViewController> controller) {
        return PopupMenuButton<MenuOptions>(
          onSelected: (MenuOptions value) {
            switch (value) {
              case MenuOptions.evaluateJavascript:
                _onEvaluateJavascript(controller.data, context);
                break;
              case MenuOptions.toast:
                Scaffold.of(context).showSnackBar(
                  SnackBar(
                    content: Text('You selected: $value'),
                  ),
                );
                break;
            }
          },
          itemBuilder: (BuildContext context) => <PopupMenuItem<MenuOptions>>[
                PopupMenuItem<MenuOptions>(
                  value: MenuOptions.evaluateJavascript,
                  child: const Text('Evaluate JavaScript'),
                  enabled: controller.hasData,
                ),
                const PopupMenuItem<MenuOptions>(
                  value: MenuOptions.toast,
                  child: Text('Make a toast'),
                ),
              ],
        );
      },
    );
  }

  void _onEvaluateJavascript(
      WebViewController controller, BuildContext context) async {
    final String result = await controller
        .evaluateJavascript("document.body.style.backgroundColor = 'red'");
    Scaffold.of(context).showSnackBar(
      SnackBar(
        content: Text('JavaScript evaluated, the result is: $result'),
      ),
    );
  }
}

class NavigationControls extends StatelessWidget {
  const NavigationControls(this._webViewControllerFuture)
      : assert(_webViewControllerFuture != null);

  final Future<WebViewController> _webViewControllerFuture;

  @override
  Widget build(BuildContext context) {
    return FutureBuilder<WebViewController>(
      future: _webViewControllerFuture,
      builder:
          (BuildContext context, AsyncSnapshot<WebViewController> snapshot) {
        final bool webViewReady =
            snapshot.connectionState == ConnectionState.done;
        final WebViewController controller = snapshot.data;
        return Row(
          children: <Widget>[
            IconButton(
              icon: const Icon(Icons.arrow_back_ios),
              onPressed: !webViewReady
                  ? null
                  : () async {
                      if (await controller.canGoBack()) {
                        controller.goBack();
                      } else {
                        Scaffold.of(context).showSnackBar(
                          const SnackBar(content: Text("No back history item")),
                        );
                        return;
                      }
                    },
            ),
            IconButton(
              icon: const Icon(Icons.arrow_forward_ios),
              onPressed: !webViewReady
                  ? null
                  : () async {
                      if (await controller.canGoForward()) {
                        controller.goForward();
                      } else {
                        Scaffold.of(context).showSnackBar(
                          const SnackBar(
                              content: Text("No forward history item")),
                        );
                        return;
                      }
                    },
            ),
            IconButton(
              icon: const Icon(Icons.replay),
              onPressed: !webViewReady
                  ? null
                  : () {
                      controller.reload();
                    },
            ),
          ],
        );
      },
    );
  }
}

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2019
@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

What about

and the full error output.

Is there more?

@zoechi zoechi added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2019
@amsmu
Copy link
Author

amsmu commented Jan 10, 2019

Nope, there is nothing more. This is the same code from the example in webview_flutter directory. Only thing I did is replace "flutter.io" with "kreatryx.com". On iOS it is working but on android it shows blank screen.

I/Choreographer(19361): Skipped 37 frames!  The application may be doing too much work on its main thread.
E/Surface (19361): queueBuffer: error queuing buffer to SurfaceTexture, -19
E/EGL_emulation(19361): tid 19403: swapBuffers(552): error 0x300d (EGL_BAD_SURFACE)
W/OpenGLRenderer(19361): swapBuffers encountered EGL error 12301 on 0x7a1f6a490880, halting rendering...
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f72fe1840, tid 19951
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f72fe1840, tid 19951
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f72fe1840, tid 19951
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f72fe1840, tid 19951
Reloaded 0 of 420 libraries in 1,382ms.
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f83941180, tid 19928
E/Surface (19361): queueBuffer: error queuing buffer to SurfaceTexture, -19
E/EGL_emulation(19361): tid 19403: swapBuffers(552): error 0x300d (EGL_BAD_SURFACE)
W/OpenGLRenderer(19361): swapBuffers encountered EGL error 12301 on 0x7a1f6a490880, halting rendering...
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 794(116KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 6.828ms total 122.157ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 102(51KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 14.869ms total 129.218ms
E/BufferQueueProducer(19361): [SurfaceTexture-0-19361-8] cancelBuffer: BufferQueue has been abandoned
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
Restarted application in 5,040ms.
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f6a25b9e0: ver 3 0 (tinfo 0x7a1f6c9a11c0)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/System  (19361): A resource failed to call release.
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 1188(107KB) AllocSpace objects, 0(0B) LOS objects, 50% free, 2MB/4MB, paused 911us total 1.168s
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 274(80KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 1.298ms total 138.951ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 81(49KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 1.563ms total 124.953ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 123(81KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 728us total 247.671ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 75(79KB) AllocSpace objects, 0(0B) LOS objects, 50% free, 2MB/4MB, paused 1.382ms total 150.728ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/chromium(19361): [INFO:CONSOLE(8)] "uncaught", source: https://dev.kreatryx.com/app.85a2a628db7e314a54db.js (8)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
Reload already in progress, ignoring request
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
Reloaded 1 of 420 libraries in 2,428ms.
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
I/Choreographer(19361): Skipped 37 frames!  The application may be doing too much work on its main thread.
E/Surface (19361): queueBuffer: error queuing buffer to SurfaceTexture, -19
E/EGL_emulation(19361): tid 19403: swapBuffers(552): error 0x300d (EGL_BAD_SURFACE)
W/OpenGLRenderer(19361): swapBuffers encountered EGL error 12301 on 0x7a1f6a708e80, halting rendering...
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
D/gralloc_ranchu(19361): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
Restarted application in 5,774ms.
D/        (19361): HostConnection::get() New Host Connection established 0x7a1f86c40620, tid 19386
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f6a25b9e0: ver 3 0 (tinfo 0x7a1f6c9a11c0)
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 173(79KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 25.082ms total 630.916ms
W/System  (19361): A resource failed to call release.
W/cr_AwContentsClient(19361): Cannot call startActivity on non-activity context.
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation(19361): eglMakeCurrent: 0x7a1f86c4f900: ver 3 0 (tinfo 0x7a1f72f8d880)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 789(67KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 1.792ms total 575.912ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 241(53KB) AllocSpace objects, 0(0B) LOS objects, 50% free, 2MB/4MB, paused 1.365ms total 592.142ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 34(47KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 929us total 202.052ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 145(80KB) AllocSpace objects, 0(0B) LOS objects, 50% free, 2MB/4MB, paused 601us total 222.630ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 68(49KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 556us total 136.820ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 29(48KB) AllocSpace objects, 0(0B) LOS objects, 50% free, 2MB/4MB, paused 1.563ms total 148.679ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 79(79KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 985us total 258.011ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 23(48KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 5.081ms total 94.436ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/wflutterexampl(19361): NativeAlloc concurrent copying GC freed 28(48KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 15.575ms total 98.368ms
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/chromium(19361): [INFO:CONSOLE(25)] "[Facebook Pixel] - An invalid email address was specified for 'em'. This data will not be sent with any events for this Pixel.", source: https://connect.facebook.net/en_US/fbevents.js (25)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread
I/chromium(19361): [INFO:CONSOLE(61)] "Uncaught TypeError: Cannot read property 'getItem' of null", source: https://www.kreatryx.com/app.4cb11855a0215a0feb1a.js (61)
I/chromium(19361): [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'getItem' of null", source: https://my.hellobar.com/modules-v42.js (1)
W/wflutterexampl(19361): Attempt to remove non-JNI local reference, dumping thread

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2019
@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

Please add the output of flutter doctor -v.

@zoechi zoechi added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2019
@amsmu
Copy link
Author

amsmu commented Jan 10, 2019

[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.2 18C54, locale en-IN)
    • Flutter version 1.0.0 at /Users/amarjeetsinghmudhar/Development/flutter
    • Framework revision 5391447fae (6 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/amarjeetsinghmudhar/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    ✗ Verify that all connected devices have been paired with this computer in Xcode.
      If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
      To update with Brew, run:
        brew update
        brew uninstall --ignore-dependencies libimobiledevice
        brew uninstall --ignore-dependencies usbmuxd
        brew install --HEAD usbmuxd
        brew unlink usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 29.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] VS Code (version 1.30.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.21.1

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2019
@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

Trying a newer Flutter version is likely worth a try.

flutter channel dev
# or flutter channel master
flutter doctor

@amsmu
Copy link
Author

amsmu commented Jan 10, 2019

Tried both and it didn't work on any of those channels.
The website is made on Reactjs. Is it a possibility that this plugin is unable to render react websites?
Could you please try running webview_flutter example on your system with "https://kreatryx.com" as initial url?

This line in the whole log is the root of the issue in my opinion.
I/chromium(22592): [INFO:CONSOLE(8)] "uncaught", source: https://kreatryx.com/app.85a2a628db7e314a54db.js (8)

@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

Is it a possibility that this plugin is unable to render react websites?

No. The plugin is just a Chrome or Safari browser depending on the platform.
The plugin is just interaction between Flutter and the browser component.

@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

Try https://www.kreatryx.com instead of https://kreatryx.com

@zoechi zoechi added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2019
@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

Duplicate of #25351

@zoechi zoechi marked this as a duplicate of #25351 Jan 10, 2019
@zoechi zoechi closed this as completed Jan 10, 2019
@amsmu
Copy link
Author

amsmu commented Jan 10, 2019

I've tried that already. Could you please try it on your computer, because our website run on mobile browser alright. It's just this plugin and that too only on android that we are facing this issue.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 10, 2019
@no-response no-response bot reopened this Jan 10, 2019
@wouterhardeman
Copy link

wouterhardeman commented Jan 10, 2019

@amsmu Have you set the javascriptMode property to JavascriptMode.unrestricted?

Edit: Just saw that you did in the snippet you posted, disregard this comment.

@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

Can you reproduce on Android, iOS, or both?

@zoechi zoechi added the platform-android Android applications specifically label Jan 10, 2019
@amsmu
Copy link
Author

amsmu commented Jan 10, 2019

Yes exactly! That's the issue. Is there any way to implement this java code WebSettings settings = webView.getSettings(); settings.setDomStorageEnabled(true);
for this plugin in flutter?

@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

I guess this will require a Pull Request.

@zoechi zoechi changed the title Webview_flutter webview is blank when initialUrl: 'https://kreatryx.com' [webview_flutter] Support settings.setDomStorageEnabled Jan 10, 2019
@amsmu
Copy link
Author

amsmu commented Jan 10, 2019

Could you please implement that in the flutter webview example?

@zoechi
Copy link
Contributor

zoechi commented Jan 10, 2019

For a short-term fix, you'll probably need to do that yourself.
Either create a PR or create a clone of the webview_flutter package.

@wouterhardeman
Copy link

wouterhardeman commented Jan 10, 2019

@amsmu You could also use flutter_webview_plugin. That one has support for local storage. It is not the 'official' plugin, but it is more mature at the moment.

@amsmu
Copy link
Author

amsmu commented Jan 10, 2019

@wouterhardeman Yup, that's my only option for time being. I wanted to stay away from it because it creates an overlay on flutter app, hence preventing any flutter UI elements such as snackbar or alert dialog to be rendered over it.

@huuang
Copy link

huuang commented Jan 22, 2019

webview_flutter is not compatible with Android, it block my release schedule.

flutter doctor -v
[✓] Flutter (Channel dev, v1.1.9, on Mac OS X 10.14.2 18C54, locale en-CN)
    • Flutter version 1.1.9 at /Users/huangjihua/Development/flutter
    • Framework revision 1407091bfb (13 days ago), 2019-01-08 20:40:19 -0800
    • Engine revision e5ec3cf3ea
    • Dart version 2.1.1 (build 2.1.1-dev.0.1 2cb346bd0c)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/huangjihua/Library/Android/sdk
    • Android NDK at /Users/huangjihua/Library/Android/sdk/ndk-bundle
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 30.0.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.30.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.21.1

[✓] Connected device (2 available)
    • PACM00           • LR9LRGO7SOSC7D85                         • android-arm64 • Android 8.1.0 (API 27)
    • Jihua's iPhone X • 902918b17e723a15acc7a4f8c3f22d4665a13fd1 • ios           • iOS 12.1.2

• No issues found!

@wouterhardeman
Copy link

@huuang Do you have an actual error for us? If it is not related, please file a new issue explaining your error.

@huuang
Copy link

huuang commented Jan 29, 2019

@wouterhardeman

I/BufferQueue(20593): [unnamed-20593-0](this:0xc0327000,id:0,api:0,p:-1,c:-1) BufferQueue core=(20593:com.xxx.xxx)
W/GuiExt  (20593): Cannot find GuiExtService
E/GED     (20593): ged_gpu_timestamp: GED_ERROR_FAIL eErr = 0, 7
I/GLConsumer(20593): [SurfaceTexture-0-20593-0] detachFromContext
E/WebViewFactory(20593): No such method for getDefinedWebViewPackageName: java.lang.NoSuchMethodException: getDefinedWebViewPackageName []
I/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) connect(P): api=1producer=(415:???) producerControlledByApp=false
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
I/WebViewFactory(20593): Loading com.google.android.webview version 62.0.3202.84 (code 320208450)
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
I/cr_LibraryLoader(20593): Time to load native libraries: 3 ms (timestamps 2846-2849)
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
I/chromium(20593): [INFO:library_loader_hooks.cc(46)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader(20593): Expected native library version number "62.0.3202.84", actual native library version number "62.0.3202.84"
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
W/cr_ChildProcLH(20593): Create a new ChildConnectionAllocator with package name = com.google.android.webview, sandboxed = true
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
I/cr_BrowserStartup(20593): Initializing chromium process, singleProcess=false
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
I/libARC  (20593): gli_eglCreateContextRet() tid:20593, ctx: 0xb9876f80, ARC not Enabled.
D/libEGL  (20593): ARC_TRACE: ARCASM_eglCreateContext() => ctx: 0xb9876f80
D/libEGL  (20593): ARC_TRACE: ARCASM_eglMakeCurrent(ctx:0xb9876f80)
D/libEGL  (20593): ARC_TRACE: ARCASM_eglMakeCurrent(ctx:0x0)
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0
D/BufferQueueProducer(20593): [SurfaceTexture-0-20593-0](this:0xc0327000,id:0,api:1,p:415,c:-1) cancelBuffer: slot 0

@huuang
Copy link

huuang commented Jan 30, 2019

@wouterhardeman Please see this issue: #27285 (comment)

@iskakaushik iskakaushik added this to the Goals milestone Apr 25, 2019
@TahaTesser
Copy link
Member

Issue isn't reproduced on

flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.19041.84], locale en-US)
    • Flutter version 1.12.13+hotfix.8 at C:\Code\flutter_stable
    • Framework revision 0b8abb4724 (4 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Code\SDK
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = C:\Code\SDK
    • Java binary at: C:\Code\android-studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Code\android-studio
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.43.0)
    • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.8.1

[√] Connected device (1 available)
    • SM M305F • 32003c30dc19668f • android-arm64 • Android 10 (API 29)

• No issues found!
Code Sample
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(MaterialApp(home: WebViewExample()));

class WebViewExample extends StatelessWidget {
  final Completer<WebViewController> _controller =
      Completer<WebViewController>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter WebView example'),
        // This drop down menu demonstrates that Flutter widgets can be shown over the web view.
        actions: <Widget>[
          NavigationControls(_controller.future),
          SampleMenu(_controller.future),
        ],
      ),
      body: WebView(
        initialUrl: 'https://kreatryx.com',
        javascriptMode: JavascriptMode.unrestricted,
        onWebViewCreated: (WebViewController webViewController) {
          _controller.complete(webViewController);
        },
      ),
      floatingActionButton: favoriteButton(),
    );
  }

  Widget favoriteButton() {
    return FutureBuilder<WebViewController>(
        future: _controller.future,
        builder: (BuildContext context,
            AsyncSnapshot<WebViewController> controller) {
          if (controller.hasData) {
            return FloatingActionButton(
              onPressed: () async {
                final String url = await controller.data.currentUrl();
                Scaffold.of(context).showSnackBar(
                  SnackBar(content: Text("Favorited $url")),
                );
              },
              child: const Icon(Icons.favorite),
            );
          }
          return Container();
        });
  }
}

enum MenuOptions {
  evaluateJavascript,
  toast,
}

class SampleMenu extends StatelessWidget {
  SampleMenu(this.controller);
  final Future<WebViewController> controller;

  @override
  Widget build(BuildContext context) {
    return FutureBuilder<WebViewController>(
      future: controller,
      builder:
          (BuildContext context, AsyncSnapshot<WebViewController> controller) {
        return PopupMenuButton<MenuOptions>(
          onSelected: (MenuOptions value) {
            switch (value) {
              case MenuOptions.evaluateJavascript:
                _onEvaluateJavascript(controller.data, context);
                break;
              case MenuOptions.toast:
                Scaffold.of(context).showSnackBar(
                  SnackBar(
                    content: Text('You selected: $value'),
                  ),
                );
                break;
            }
          },
          itemBuilder: (BuildContext context) => <PopupMenuItem<MenuOptions>>[
            PopupMenuItem<MenuOptions>(
              value: MenuOptions.evaluateJavascript,
              child: const Text('Evaluate JavaScript'),
              enabled: controller.hasData,
            ),
            const PopupMenuItem<MenuOptions>(
              value: MenuOptions.toast,
              child: Text('Make a toast'),
            ),
          ],
        );
      },
    );
  }

  void _onEvaluateJavascript(
      WebViewController controller, BuildContext context) async {
    final String result = await controller
        .evaluateJavascript("document.body.style.backgroundColor = 'red'");
    Scaffold.of(context).showSnackBar(
      SnackBar(
        content: Text('JavaScript evaluated, the result is: $result'),
      ),
    );
  }
}

class NavigationControls extends StatelessWidget {
  const NavigationControls(this._webViewControllerFuture)
      : assert(_webViewControllerFuture != null);

  final Future<WebViewController> _webViewControllerFuture;

  @override
  Widget build(BuildContext context) {
    return FutureBuilder<WebViewController>(
      future: _webViewControllerFuture,
      builder:
          (BuildContext context, AsyncSnapshot<WebViewController> snapshot) {
        final bool webViewReady =
            snapshot.connectionState == ConnectionState.done;
        final WebViewController controller = snapshot.data;
        return Row(
          children: <Widget>[
            IconButton(
              icon: const Icon(Icons.arrow_back_ios),
              onPressed: !webViewReady
                  ? null
                  : () async {
                      if (await controller.canGoBack()) {
                        controller.goBack();
                      } else {
                        Scaffold.of(context).showSnackBar(
                          const SnackBar(content: Text("No back history item")),
                        );
                        return;
                      }
                    },
            ),
            IconButton(
              icon: const Icon(Icons.arrow_forward_ios),
              onPressed: !webViewReady
                  ? null
                  : () async {
                      if (await controller.canGoForward()) {
                        controller.goForward();
                      } else {
                        Scaffold.of(context).showSnackBar(
                          const SnackBar(
                              content: Text("No forward history item")),
                        );
                        return;
                      }
                    },
            ),
            IconButton(
              icon: const Icon(Icons.replay),
              onPressed: !webViewReady
                  ? null
                  : () {
                      controller.reload();
                    },
            ),
          ],
        );
      },
    );
  }
}

Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of 'flutter doctor -v' please.
All system setups can be slightly different so it's always better to open new issues and reference related issues.
Thank you

@lock
Copy link

lock bot commented Apr 4, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@lock lock bot locked and limited conversation to collaborators Apr 4, 2020
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console p: webview The WebView plugin package flutter/packages repository. See also p: labels. platform-android Android applications specifically
Projects
None yet
Development

No branches or pull requests

6 participants