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

Android ContentBlocker - java.lang.NullPointerException ContentBlockerTrigger resource type #506

Closed
KarmaEstudio opened this issue Sep 3, 2020 · 2 comments

Comments

@KarmaEstudio
Copy link

Hi.

Thank you for this amazing plugin.

Do you have examples of use of ContentBlocker?

I´m trying to use it for block content but I get errors.

This is my code:

contentBlockers: [
                        ContentBlocker(
                          trigger: ContentBlockerTrigger(
                            urlFilter: widget.url,
                          ),
                          action: ContentBlockerAction(
                            type: ContentBlockerActionType.CSS_DISPLAY_NONE,
                            selector: 'h1.title,div.site-trigger,div.leaderboard',
                          ),
                        ),
                      ],

And I get this exception:

E/MethodChannel#flutter/platform_views(13038): Failed to handle method call
E/MethodChannel#flutter/platform_views(13038): java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
E/MethodChannel#flutter/platform_views(13038): 	at com.pichillilorenzo.flutter_inappwebview.ContentBlocker.ContentBlockerTrigger.fromMap(ContentBlockerTrigger.java:44)
E/MethodChannel#flutter/platform_views(13038): 	at com.pichillilorenzo.flutter_inappwebview.InAppWebView.InAppWebView.prepare(InAppWebView.java:814)
E/MethodChannel#flutter/platform_views(13038): 	at com.pichillilorenzo.flutter_inappwebview.InAppWebView.FlutterWebView.<init>(FlutterWebView.java:92)
E/MethodChannel#flutter/platform_views(13038): 	at com.pichillilorenzo.flutter_inappwebview.InAppWebView.FlutterWebViewFactory.create(FlutterWebViewFactory.java:28)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:186)
E/MethodChannel#flutter/platform_views(13038): 	at android.app.Dialog.dispatchOnCreate(Dialog.java:423)
E/MethodChannel#flutter/platform_views(13038): 	at android.app.Dialog.show(Dialog.java:317)
E/MethodChannel#flutter/platform_views(13038): 	at android.app.Presentation.show(Presentation.java:250)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.plugin.platform.VirtualDisplayController.<init>(VirtualDisplayController.java:95)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:48)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:170)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:230)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter/platform_views(13038): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/MethodChannel#flutter/platform_views(13038): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter/platform_views(13038): 	at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#flutter/platform_views(13038): 	at android.os.Looper.loop(Looper.java:181)
E/MethodChannel#flutter/platform_views(13038): 	at android.app.ActivityThread.main(ActivityThread.java:7560)
E/MethodChannel#flutter/platform_views(13038): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/platform_views(13038): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
E/MethodChannel#flutter/platform_views(13038): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
I/Ads     (13038): Ad failed to load : 3
E/flutter (13038): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: PlatformException(error, Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference, null)
E/flutter (13038): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:572:7)
E/flutter (13038): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:161:18)
E/flutter (13038): <asynchronous suspension>
E/flutter (13038): #2      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:334:12)
E/flutter (13038): #3      TextureAndroidViewController._sendCreateMessage (package:flutter/src/services/platform_views.dart:1039:54)
E/flutter (13038): #4      AndroidViewController.create (package:flutter/src/services/platform_views.dart:746:11)
E/flutter (13038): #5      TextureAndroidViewController.create (package:flutter/src/services/platform_views.dart:1017:34)
E/flutter (13038): #6      TextureAndroidViewController.setSize (package:flutter/src/services/platform_views.dart:1001:14)
E/flutter (13038): #7      RenderAndroidView._sizePlatformView (package:flutter/src/rendering/platform_view.dart:176:29)
E/flutter (13038): #8      RenderAndroidView.performResize (package:flutter/src/rendering/platform_view.dart:157:5)
E/flutter (13038): #9      RenderObject.layout (package:flutter/src/rendering/object.dart:1748:9)
E/flutter (13038): #10     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #11     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #12     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:209:11)
E/flutter (13038): #13     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #14     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #15     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #16     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:209:11)
E/flutter (13038): #17     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #18     RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:827:17)
E/flutter (13038): #19     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #20     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:173:11)
E/flutter (13038): #21     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:495:7)
E/flutter (13038): #22     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:242:7)
E/flutter (13038): #23     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:401:14)
E/flutter (13038): #24     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #25     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #26     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #27     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #28     _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1269:11)
E/flutter (13038): #29     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #30     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #31     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #32     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #33     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #34     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #35     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #36     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #37     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #38     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #39     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
E/flutter (13038): #40     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
E/flutter (13038): #41     RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)

Thank you!

@KarmaEstudio KarmaEstudio changed the title ContentBlocker - Examples ContentBlocker - Examples? Sep 3, 2020
@pichillilorenzo pichillilorenzo changed the title ContentBlocker - Examples? Android ContentBlocker - java.lang.NullPointerException ContentBlockerTrigger resource type Sep 7, 2020
@CarmenLexa
Copy link

I have the same error, could you solve it?

Copy link

github-actions bot commented Nov 8, 2024

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 and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants