Skip to content

Lexical or Preprocessor Issue (Xcode): Redefinition of module 'image_picker_ios' #148307

Closed

Description

@mu7mmd

Steps to reproduce

  1. Add image_picker: ^1.1.1 to pubspec.yaml
  2. flutter clean
  3. flutter pub get
  4. cd ios
  5. rm -rf Pods Podfile.lock
  6. pod cache clean --allpod
  7. pod install
  8. flutter run

Expected results

Application build successfully and opening the app

Actual results

Lexical or Preprocessor Issue (Xcode): Redefinition of module 'image_picker_ios' /Users/user/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.11+1/ios/image_picker_ios/Sources/image_picker_ios/include/module.modulemap:0:7

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.22.0, on macOS 12.7.4 21H1123 darwin-x64, locale en-IT)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
    ! Flutter recommends a minimum Xcode version of 15.
      Download the latest version or update via the Mac App Store.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[!] Android Studio (version unknown)
    ✗ Unable to determine Android Studio version.
[✓] VS Code (version 1.86.1)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 3 categories.

Activity

  1. darshankawar commented on May 14, 2024

    @darshankawar
    Member

    Thanks for the report. I am able to replicate this behavior in a demo existing app in which I get below:

    Screenshot 2024-05-14 at 6 28 42 PM

    I also created a new Flutter project, just added image_picker and then tried to run via Xcode in which I get below error:

    Screenshot 2024-05-14 at 6 33 43 PM

    Keeping the issue open for team's input / attention on reported behavior.

    stable, master flutter doctor -v
    [!] Flutter (Channel stable, 3.22.0, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.22.0 on channel stable at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 5dcb86f68f (5 days ago), 2024-05-09 07:39:20 -0500
        • Engine revision f6344b75dc
        • Dart version 3.4.0
        • DevTools version 2.34.3
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.22.0-30.0.pre.11, on macOS 12.2.1 21D62
        darwin-x64, locale en-GB)
        • Flutter version 3.22.0-30.0.pre.11 on channel master at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision c90e18c6f5 (2 hours ago), 2024-05-09 20:32:11 -0700
        • Engine revision c0917b14fc
        • Dart version 3.5.0 (build 3.5.0-138.0.dev)
        • DevTools version 2.36.0-dev.5
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Users/dhs/Library/Android/sdk
        ✗ cmdline-tools component is missing
          Run `path/to/sdkmanager --install "cmdline-tools;latest"`
          See https://developer.android.com/studio/command-line for more details.
        ✗ Android license status unknown.
          Run `flutter doctor --android-licenses` to accept the SDK licenses.
          See https://flutter.dev/docs/get-started/install/macos#android-setup for
          more details.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13C100
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 65.1.4
        • Dart plugin version 213.7228
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (3 available)
        • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
          • iOS 15.3.1 19D52
        • macOS (desktop)           • macos                                    •
          darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)              • chrome                                   •
          web-javascript • Google Chrome 109.0.5414.119
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
          
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
    
    
  2. added
    platform-iosiOS applications specifically
    packageflutter/packages repository. See also p: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    fyi-ecosystemFor the attention of Ecosystem team
    team-iosOwned by iOS platform team
    t: xcode"xcodebuild" on iOS and general Xcode project management
    and removed
    in triagePresently being triaged by the triage team
    on May 14, 2024
  3. mu7mmd commented on May 14, 2024

    @mu7mmd
    Author

    @darshankawar, Thank you for your response. When I downgraded to version 3.19.6, I encountered the same issue. However, when I further downgraded to version 3.19.5, the problem was resolved and it functioned correctly.

  4. loic-sharma commented on May 14, 2024

    @loic-sharma
    Member

    This might have been caused by the Swift Package Manager migration done in package:image_picker_ios version 0.8.11, /cc @vashworth

  5. loic-sharma commented on May 14, 2024

    @loic-sharma
    Member

    I wasn't able to reproduce this using Xcode 15.0 and newer. I suspect this only happens on Xcode 14.

    Could you try the following workarounds:

    1. Could you try pinning to package:image_picker_ios version 0.8.10 or older? This is before Swift Package Manager support was added
    2. Could you try upgrading to Xcode 15.0 or newer?

    Please let us know which of these options, if any, fix this issue. That'll help us understand this build error better.

  6. 14 remaining items

  7. vashworth commented on May 16, 2024

    @vashworth
    Contributor

    Issue should be resolved with latest version of image_picker_ios (image_picker_ios-0.8.10+2). Try flutter pub upgrade

  8. EmmyTechnology commented on May 17, 2024

    @EmmyTechnology

    Hi, I tried to create ipa by using Azure CI-CD but I got the same error. I tried both flutter version that you mentioned above (3.19.5 and 3.19.6) then same error I got.
    Error: Lexical or Preprocessor Issue (Xcode): Redefinition of module 'image_picker_ios' /Users/runner/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.11+1/ios/image_picker_ios/Sources/image_picker_ios/include/module.modulemap:0:7
    I think it is caused by auto update for inner libraries.
    If you add image_picker_ios-0.8.10+1 as dependency_overrides the problem will fixed.

    How do you add that, because I am using flutter

    In pubsec.yaml file add this; dependency_overrides: image_picker_ios: 0.8.10+1

    it works for me. Thanks

  9. loic-sharma commented on May 20, 2024

    @loic-sharma
    Member

    Please let us know if anyone can reproduce this issue after using flutter pub upgrade!

  10. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 20, 2024
  11. github-actions commented on Jun 10, 2024

    @github-actions

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
    If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
    Thanks for your contribution.

  12. github-actions commented on Jun 24, 2024

    @github-actions

    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.

  13. locked as resolved and limited conversation to collaborators on Jun 24, 2024
  14. added theissue type on Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: image_pickerThe Image Picker plugin.packageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyt: xcode"xcodebuild" on iOS and general Xcode project managementteam-iosOwned by iOS platform teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions