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

conflict with webview_flutter #11

Closed
3ace opened this issue May 5, 2019 · 23 comments
Closed

conflict with webview_flutter #11

3ace opened this issue May 5, 2019 · 23 comments
Labels

Comments

@3ace
Copy link

3ace commented May 5, 2019

when I include both webview_flutter and youtube_player_flutter, application would crash upon starts with the following warning and error

objc[44664]: Class FLTCookieManager is implemented in both /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/ytview.framework/ytview (0x10c3d8400) and /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/webview_flutter.framework/webview_flutter (0x10c3bb250). One of the two will be used. Which one is undefined.
objc[44664]: Class FLTWKNavigationDelegate is implemented in both /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/ytview.framework/ytview (0x10c3d8450) and /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/webview_flutter.framework/webview_flutter (0x10c3bb2a0). One of the two will be used. Which one is undefined.
objc[44664]: Class FLTWebViewFactory is implemented in both /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/ytview.framework/ytview (0x10c3d84a0) and /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/webview_flutter.framework/webview_flutter (0x10c3bb2f0). One of the two will be used. Which one is undefined.
objc[44664]: Class FLTWebViewController is implemented in both /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/ytview.framework/ytview (0x10c3d84c8) and /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/webview_flutter.framework/webview_flutter (0x10c3bb318). One of the two will be used. Which one is undefined.
objc[44664]: Class FLTJavaScriptChannel is implemented in both /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/ytview.framework/ytview (0x10c3d8540) and /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/webview_flutter.framework/webview_flutter (0x10c3bb390). One of the two will be used. Which one is undefined.
objc[44664]: Class FLTWebViewFlutterPlugin is implemented in both /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/ytview.framework/ytview (0x10c3d85b8) and /Users/ace/Library/Developer/CoreSimulator/Devices/B18AEF78-2279-4A87-AF9C-EC10E395036D/data/Containers/Bundle/Application/7210DA0C-0DBD-40B3-82E4-83D52BA8ADF7/Runner.app/Frameworks/webview_flutter.framework/webview_flutter (0x10c3bb458). One of the two will be used. Which one is undefined.
2019-05-04 09:20:00.568482+0700 Runner[44664:362412] libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.
2019-05-04 09:20:00.844000+0700 Runner[44664:362412] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
2019-05-04 09:20:00.844196+0700 Runner[44664:362412] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2019-05-04 09:20:00.845692+0700 Runner[44664:362412] *** Assertion failure in -[FlutterEngine registrarForPlugin:], ../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm:560
2019-05-04 09:20:00.917563+0700 Runner[44664:362412] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Duplicate plugin key: FLTWebViewFlutterPlugin'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010d4296fb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x000000010c9cdac5 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010d429482 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x000000010c41b927 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
	4   Flutter                             0x000000010a5a3d6b -[FlutterEngine registrarForPlugin:] + 269
	5   Runner                              0x000000010a29be1e +[GeneratedPluginRegistrant registerWithRegistry:] + 174
	6   Runner                              0x000000010a29bf18 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 168
	7   Runner                              0x000000010a29c254 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 196
	8   UIKitCore                           0x0000000116d3b311 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
	9   UIKitCore                           0x0000000116d3ccad -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3932
	10  UIKitCore                           0x0000000116d420c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
	11  UIKitCore                           0x00000001165876d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
	12  UIKitCore                           0x000000011658ffce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
	13  UIKitCore                           0x00000001165872ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
	14  UIKitCore                           0x0000000116587c48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
	15  UIKitCore                           0x0000000116585fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
	16  UIKitCore                           0x0000000116585c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
	17  UIKitCore                           0x000000011658a9b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
	18  UIKitCore                           0x000000011658b610 _performActionsWithDelayForTransitionContext + 100
	19  UIKitCore                           0x000000011658a71d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
	20  UIKitCore                           0x000000011658f6d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
	21  UIKitCore                           0x0000000116d409a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
	22  UIKitCore                           0x00000001168f7dfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
	23  FrontBoardServices                  0x0000000118d71125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
	24  FrontBoardServices                  0x0000000118d7aed6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
	25  FrontBoardServices                  0x0000000118d7a700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
	26  libdispatch.dylib                   0x0000000110db5db5 _dispatch_client_callout + 8
	27  libdispatch.dylib                   0x0000000110db92ba _dispatch_block_invoke_direct + 300
	28  FrontBoardServices                  0x0000000118dac146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
	29  FrontBoardServices                  0x0000000118dabdfe -[FBSSerialQueue _performNext] + 451
	30  FrontBoardServices                  0x0000000118dac393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
	31  CoreFoundation                      0x000000010d390be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	32  CoreFoundation                      0x000000010d390463 __CFRunLoopDoSources0 + 243
	33  CoreFoundation                      0x000000010d38ab1f __CFRunLoopRun + 1231
	34  CoreFoundation                      0x000000010d38a302 CFRunLoopRunSpecific + 626
	35  GraphicsServices                    0x0000000111ba92fe GSEventRunModal + 65
	36  UIKitCore                           0x0000000116d43ba2 UIApplicationMain + 140
	37  Runner                              0x000000010a29c3f8 main + 72
	38  libdyld.dylib                       0x0000000110e2a541 start + 1
	39  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I had to remove webview_flutter to be able to run the application.

I only tested this problem on iOS using simulator.

@GeertJohan
Copy link

A related problem occurs on android, where the following exception is thrown and the application exits before first frame render.
E/AndroidRuntime( 6955): java.lang.RuntimeException: Unable to start activity ComponentInfo{my.app/my.app.MainActivity}: java.lang.IllegalStateException: Plugin key io.flutter.plugins.webviewflutter.WebViewFlutterPlugin is already in use

@sarbagyastha
Copy link
Owner

Sorry for late response 😐, but this plugin has in-built webview plugin, so no need to add webview plugin separately.

@GeertJohan
Copy link

@sarbagyastha But my app also uses the webview directly. Can it use the forked version, will that be kept up-to-date with the latest version of webview_flutter? Can the changes in this plugin's fork of webview_flutter be merged upstream so it no longer requires the fork?

@Xoshbin
Copy link

Xoshbin commented May 15, 2019

D8: Program type already present: io.flutter.plugins.webviewflutter.BuildConfig

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list:
  Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: io.flutter.plugins.webviewflutter.BuildConfig

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
Finished with error: Gradle task assembleDebug failed with exit code 1

I'm using webview_flutter: ^0.3.6 in my app but when having both of them it gives the above error. and when I remove the webview_flutter: ^0.3.6 it gives error because my app needs it.

@sarbagyastha
Copy link
Owner

@GeertJohan yes the forked version will be kept up-to-date for major updates and performance improvements. Yes, it could be merged but takes a long time to get merge, there are currently many pending webview_flutter PRs in project tracking.

@sarbagyastha
Copy link
Owner

@Xoshbin , will be updating the plugin tonight, where access to in-built webview will be exported.

@Xoshbin
Copy link

Xoshbin commented May 15, 2019

@sarbagyastha Thanks I will wait for it then :)

@sarbagyastha
Copy link
Owner

Version 1.1.1 addresses the issue.

@Xoshbin
Copy link

Xoshbin commented May 15, 2019

It's not working for me yet, I did remove the webview from dependencies it still gives error, and when I add it it still gives the same error above.

@sarbagyastha
Copy link
Owner

sarbagyastha commented May 15, 2019

did you perform full build ?
Also try running flutter clean

@Xoshbin
Copy link

Xoshbin commented May 15, 2019

Yes I did a full build, and flutter clean with and without the webview_flutter

@sarbagyastha
Copy link
Owner

Also, If you're using Android Studio, please try invalidating cache. Or perform gradlew clean.
This might be due to leftover of webview_flutter plugin.

@Xoshbin
Copy link

Xoshbin commented May 15, 2019

Do I have to keep the webview_flutter in the dependancies or remove it?

@Xoshbin
Copy link

Xoshbin commented May 15, 2019

I did that too, still not working!

@3ace
Copy link
Author

3ace commented May 15, 2019

I'm able to use the built in WebView using this import statement

import 'package:ytview/ytview.dart';

I think this should be mentioned in the Readme file

@sarbagyastha
Copy link
Owner

@Xoshbin @3ace You'll need to remove webview_flutter. And with the latest update
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
includes WebView widget.
It's mentioned in Note section of readme.

@Xoshbin
Copy link

Xoshbin commented May 16, 2019

@sarbagyastha Thanks it's working now.

@adrianvintu
Copy link

Can you please make a big note about this in the readme?

And also add the import as specified by @3ace ?

import 'package:ytview/ytview.dart';

This was a very difficult issue to debug.

Maybe actually add a link to this page in the readme?

I find that the existing text is not very clear, especially for someone new to Flutter.

Existing text:
The plugin causes conflict with webview_flutter plugin as this plugin already contains webview as its dependency. So there is no need of separately adding webview_flutter. You can use WebView from the plugin itself.

Proposal text:

Conflict with webview

You may get an exception like:
program type already present: io.flutter.plugins.webviewflutter
or
Plugin key io.flutter.plugins.webviewflutter.WebViewFlutterPlugin is already in use

The plugin causes conflict with webview_flutter plugin as this plugin already contains webview as its dependency. So there is no need of separately adding webview_flutter. You can use WebView from the plugin itself.

This means:

  1. you delete/comment out
dependencies:
  webview_flutter: ^0.3.0
  1. you use import 'package:ytview/ytview.dart';
  2. optionally, see this ticket for more information

How does this text sound to you?

Thank you for the great work, by the way!

@yamarkz
Copy link

yamarkz commented Jun 23, 2019

thanks! Great work 😸

@ziggycrane
Copy link

ziggycrane commented Mar 10, 2020

When I import
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
and remove "webview_flutter: 0.3.19+7", install all the packages and even flutter clean - it does not work.

It throws an error that - The method "WebView" is not defined.

@srinivasanrsp
Copy link

srinivasanrsp commented Mar 11, 2020

YouTube player plugin uses another plugin webview_media and that uses webview_flutter plugin, so use following import the error should be gone

import 'package:webview_media/webview_flutter.dart'

@jameskaguo777
Copy link

import 'package:webview_media/webview_flutter.dart'

This is the most correct Answer.

@NtemKenyor
Copy link

I had the same issue using webview_flutter and youtube_player_flutter. I used the solution by @srinivasanrsp. It works.

  1. Remove the webview_flutter package from the pubspec.yaml file
  2. Use import 'package:webview_media/webview_flutter.dart';

This works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants