avioli / uni_links

Flutter plugin for accepting incoming links.
BSD 2-Clause "Simplified" License
564 stars 315 forks source link

Error build ios: 'uni_links2.UniLinksPlugin' found 2 referenced protocols #115

Open Andranjo97 opened 3 years ago

Andranjo97 commented 3 years ago

I'm testing on an iOS Simulator, which is running iOS14.0.

When I run a build for iOS, I get the following error:

In module 'uni_links' imported from /Users/mypc/Projects/myproject/ios/Runner/GeneratedPluginRegistrant.m:146:
    /Users/mypc/Projects/myproject/build/ios/Release-stg-iphoneos/uni_links/uni_links.framework/Headers/UniLinksPlugin.h:5:12: error: 'UniLinksPlugin' has different definitions in different modules; first difference is definition in module 'uni_links.UniLinksPlugin' found 1 referenced protocol
    @interface UniLinksPlugin : NSObject <FlutterPlugin>
               ^                          ~~~~~~~~~~~~~
    In module 'uni_links2' imported from /Users/mypc/Projects/myproject/ios/Runner/GeneratedPluginRegistrant.m:152:
    /Users/mypc/Projects/myproject/build/ios/Release-stg-iphoneos/uni_links2/uni_links2.framework/Headers/UniLinksPlugin.h:9:12: note: but in 'uni_links2.UniLinksPlugin' found 2 referenced protocols
    @interface UniLinksPlugin : NSObject <FlutterPlugin, UriDelegate>
               ^                          ~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 warning and 1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

This happened when I updated the plugin uni_links to ^0.5.1. I already tried removing my Pods, and my Podfile.lock. Is there something I'm missing from the implementation?

fauzipadlaw commented 3 years ago

same issue but build error android:

[ +2 ms] ERROR:/Users/efzet/work/project/build/uni_links2/intermediates/runtime_library_classes_jar/release/classes.jar: R8: Type name.avioli.unilinks.BuildConfig is defined multiple times: /Users/efzet/work/project/build/uni_links2/intermediates/runtime_library_classes_jar/release/classes.jar:name/avioli/unilinks/BuildConfig.class, /Users/efzet/work/project/build/uni_links/intermediates/runtime_library_classes_jar/release/classes.jar:name/avioli/unilinks/BuildConfig.class [ +94 ms] FAILURE: Build failed with an exception. [ ] What went wrong: [ ] Execution failed for task ':app:minifyReleaseWithR8'. [ ] > com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/efzet/work/project/build/uni_links2/intermediates/runtime_library_classes_jar/release/classes.jar:name/avioli/unilinks/BuildConfig.class [ +1 ms] 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 17s

JamesMcIntosh commented 3 years ago

@Andranjo97 @fauzipadlaw Looks like you both have uni_links and uni_links2. Did you add uni_links2 while waiting for the last release to come out and forget to remove it? To fix update your pubspec.yaml

fauzipadlaw commented 3 years ago

@JamesMcIntosh, I do not put any uni_links in my pubspec.yaml

JamesMcIntosh commented 3 years ago

@fauzipadlaw you can see from these two lines that in the build folder both of them exist in your project.

I would recommend switching back to uni_links dependency, then do a flutter clean and try building again.

/Users/efzet/work/project/build/uni_links2/intermediates/runtime_library_classes_jar/release/classes.jar:name/avioli/unilinks/BuildConfig.class,
/Users/efzet/work/project/build/uni_links/intermediates/runtime_library_classes_jar/release/classes.jar:name/avioli/unilinks/BuildConfig.class
Andranjo97 commented 3 years ago

@JamesMcIntosh no, I don't have uni_links2 as a dependency. Here is my pubspec.yaml.

name: myproject
description: my-project

publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.50.0-1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.3
  shared_preferences: ^2.0.5
  random_string: ^2.2.0-nullsafety
  hexcolor: ^2.0.3
  firebase_messaging: ^9.1.4
  another_flushbar: ^1.10.20
  # Service locator
  get_it: ^7.1.3
  # Bloc for state management
  flutter_bloc: ^7.0.0
  bloc_test: ^8.0.0
  # Redux for state management
  flutter_redux: ^0.8.2
  redux: ^5.0.0
  redux_thunk: ^0.4.0
  # Value equality
  equatable: ^2.0.0
  # Functional programming thingies
  dartz: ^0.10.0-nullsafety.2
  # Remote API
  data_connection_checker_tv: ^0.3.4-nullsafety
  flutter_web_auth: ^0.3.0
  # Persistency
  sqflite: ^2.0.0+3
  path_provider: ^2.0.1
  # Image
  image_picker: ^0.7.5
  cached_network_image: ^3.0.0
  # Indicator
  percent_indicator: ^3.0.1
  # Http request
  http: ^0.13.3
  # In app payment
  square_in_app_payments: ^1.7.1
  # Fonts
  font_awesome_flutter: ^9.0.0
  # App launcher
  url_launcher: ^6.0.3
  # Share option
  share: ^2.0.1
  flutter_svg: ^0.22.0
  characters: ^1.1.0
  validators: ^3.0.0
  # Yaml reader
  yaml: ^3.1.0
  # Webview
  webview_flutter: ^2.0.4
  # PDF viewer
  pdf_viewer_jk: ^2.1.0
  # Analytics
  firebase_analytics: ^8.0.4
  # Crashlytics
  firebase_crashlytics: ^2.0.3
  firebase_core: ^1.1.1
  #Image multi picker
  multi_image_picker: ^4.8.00
  # Image carousel slider
  carousel_slider: ^4.0.0-nullsafety.0
  # Timezone
  flutter_native_timezone: ^1.0.10
  timezone: ^0.7.0
  #Firebase dynamic links
  firebase_dynamic_links: ^2.0.3
  uni_links: ^0.5.1
  #Stripe
  stripe_sdk: ^5.0.0-nullsafety.0
  #Color picker
  flex_color_picker: ^2.0.1
  intl: ^0.17.0
  # CSV
  csv: ^5.0.0
  # PDF
  pdf: ^3.3.0
  # permission handler
  permission_handler: ^7.1.0
  # External storage
  ext_storage:
    git:
      url: git://github.com/GitJournal/ext_storage.git
  intl_phone_number_input: ^0.7.0+2
  intl_phone_field: ^2.0.0
  open_file: ^3.2.1
  plaid_flutter: ^2.1.2
  fluttertoast: ^8.0.6

dependency_overrides:
  crypto: '>=2.1.5'
  archive: '>=2.0.13'
  convert: '>=2.1.1'

dev_dependencies:
  flutter_driver:
    sdk: flutter
  test: ^1.16.5
  flutter_test:
    sdk: flutter
  mockito: ^5.0.7

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/home_page/home_page_background.jpg"

flutter:
  uses-material-design: true
  fonts:
    - family: Pacifico
      fonts:
        - asset: fonts/Pacifico-Regular.ttf
  assets:
    - assets/
    - assets/home_page/
    - assets/google_logo/
    - assets/facebook_logo/
    - assets/apple_logo/
    - assets/secrets/
    - assets/default_images/
    - assets/credit_cards/
    - assets/icons/
    - pubspec.yaml

I have run a flutter clean, pod deintegrate, removed the Pods. No luck so far. See when running the command pod install, it automatically installs uni_links2:

...
Installing square_in_app_payments (1.3.0)
Installing uni_links (0.0.1)
Installing uni_links2 (0.0.1)
Installing url_launcher (0.0.1)
...

It appears to me that uni_links adds the dependency uni_links2 by itself

Andranjo97 commented 3 years ago

@fauzipadlaw a workaround was actually using the uni_links2 library instead of using the uni_links dependency. With that I got a successful build

JamesMcIntosh commented 3 years ago

@Andranjo97 What happens when you run flutter pub pub dependencies | grep uni_links -A1? This is what you should see:

|-- uni_links 0.5.1
|   |-- uni_links_platform_interface 1.0.0
|   '-- uni_links_web 0.1.0
|       '-- uni_links_platform_interface...
JamesMcIntosh commented 3 years ago

@fauzipadlaw a workaround was actually using the uni_links2 library instead of using the uni_links dependency. With that I got a successful build

I wouldn't recommend using it for anything other than a stop-gap as it is not maintained (and should never have been published to the pub repository). It is already 22 commits behind uni_links.

fauzipadlaw commented 3 years ago

@Andranjo97 What happens when you run flutter pub pub dependencies | grep uni_links -A1? This is what you should see:

|-- uni_links 0.5.1
|   |-- uni_links_platform_interface 1.0.0
|   '-- uni_links_web 0.1.0
|       '-- uni_links_platform_interface...
|   |-- uni_links 0.4.0
|   |   '-- flutter...
--
|   |-- uni_links2 0.6.0+2
|   |   |-- flutter...
--
|   |   |-- uni_links2_platform_interface 1.0.0+2
|   |   |   |-- flutter...
--
|   |   '-- uni_links_web2 0.1.0+2
|   |       |-- flutter...
--
|   |       '-- uni_links2_platform_interface...
|   '-- url_launcher...
fauzipadlaw commented 3 years ago

I use stripe_sdk and one of its dependencies is uni_links2. Sigh.