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

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

Open
Tracked by #126005
mu7mmd opened this issue May 14, 2024 · 19 comments
Open
Tracked by #126005
Labels
found in release: 3.22 Found to occur in 3.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: image_picker The Image Picker plugin. package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management team-ios Owned by iOS platform team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@mu7mmd
Copy link

mu7mmd commented May 14, 2024

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.
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label May 14, 2024
@darshankawar
Copy link
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.



@darshankawar darshankawar added platform-ios iOS applications specifically p: image_picker The Image Picker plugin. package flutter/packages repository. See also p: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on fyi-ecosystem For the attention of Ecosystem team team-ios Owned by iOS platform team found in release: 3.22 Found to occur in 3.22 t: xcode "xcodebuild" on iOS and general Xcode project management and removed in triage Presently being triaged by the triage team labels May 14, 2024
@mu7mmd
Copy link
Author

mu7mmd commented May 14, 2024

@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.

@loic-sharma
Copy link
Member

loic-sharma commented May 14, 2024

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

@stuartmorgan stuartmorgan added the triaged-ecosystem Triaged by Ecosystem team label May 14, 2024
@loic-sharma
Copy link
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.

@hectorvillag
Copy link

I have the same problem after updating to flutter 3.22.0
image

@rabinacharya11
Copy link

I am facing the same issue after updating to flutter 3.22.0

Screen Shot 2024-05-15 at 21 06 39

@loic-sharma
Copy link
Member

@hectorvillag @rabinacharya11 Could you try the workarounds listed above?

  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.

@q8yas2
Copy link

q8yas2 commented May 15, 2024

this is my temporary solution
1 - make folder in ur main project named "packages"
2 - add folder i attachment after unzip in packages folder
3 - add this in pubspec.yaml

  image_picker:
    path: packages/image_picker/

image_picker.zip

OR

keep the default in pubspec.yaml

image_picker: ^1.1.1

and add this

dependency_overrides:
  image_picker_ios: 0.8.11

@tienle219
Copy link

I am facing the same issue after updating to flutter 3.22.0

Screen Shot 2024-05-15 at 21 06 39

I also have the same issue, do you have a solution?

@vashworth
Copy link
Contributor

Can anyone confirm if upgrading to Xcode 15 resolves the issue?

@flutter-triage-bot flutter-triage-bot bot removed fyi-ecosystem For the attention of Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels May 15, 2024
@hectorvillag
Copy link

hectorvillag commented May 15, 2024

Can anyone confirm if upgrading to Xcode 15 resolves the issue?

image

It seems to work, when I changed it to use xcode 15 in this task everything worked correctly

@rajatiota
Copy link

rajatiota commented May 16, 2024

I am facing the same issue after updating to flutter 3.22.0

Screen Shot 2024-05-15 at 21 06 39

i Am also getting same error after flutter pub upgrade flutter version is 3.19.6
and try all available given solutions downgrade my flutter version to 3.19.5 nothing change error still exists

@EmmyTechnology
Copy link

Running Xcode build...
Xcode build done. 433.2s
Failed to build iOS app
Lexical or Preprocessor Issue (Xcode): Redefinition of module 'image_picker_ios'
/Users/xxxx/.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

Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).

Has anyone resolve the similar problem here

@BurakAkten
Copy link

BurakAkten commented May 16, 2024

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.

@EmmyTechnology
Copy link

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

@BurakAkten
Copy link

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

auto-submit bot pushed a commit to flutter/packages that referenced this issue May 16, 2024
…6740)

Plugins converted to Swift Package Manager that use a modulemap seem to be having issues with there being a `module.modulemap`. As a temporary solution to unblock people, we'll remove the `module.modulemap` and Swift Package support (`Package.swift`). 

Temporary solution for flutter/flutter#148307.
@vashworth
Copy link
Contributor

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

@EmmyTechnology
Copy link

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

@loic-sharma
Copy link
Member

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

@loic-sharma loic-sharma added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 20, 2024
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this issue May 22, 2024
…lutter#6740)

Plugins converted to Swift Package Manager that use a modulemap seem to be having issues with there being a `module.modulemap`. As a temporary solution to unblock people, we'll remove the `module.modulemap` and Swift Package support (`Package.swift`). 

Temporary solution for flutter/flutter#148307.
auto-submit bot pushed a commit to flutter/packages that referenced this issue May 31, 2024
Adds Swift Package Manager compatibility to `image_picker_ios`.

The previous attempt, #6617, was partially reverted due to flutter/flutter#148307. This reland uses the new approach proposed in flutter/flutter#148572: the Swift Package Manager package does not have a `.modulemap`. As a result, the plugin no longer has a `.Test` submodule if using Swift Package Manager.

Fixes flutter/flutter#146919.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
found in release: 3.22 Found to occur in 3.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: image_picker The Image Picker plugin. package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management team-ios Owned by iOS platform team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

No branches or pull requests