mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

iOS 17 Cannot properly build release version

Open blk-raffy opened this issue 1 year ago • 5 comments

Description

All started by this error: Could not find module 'MapboxMaps' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator

I've found other closed issue but they were old and not currently working.

Context:

I'm using an M1 chip

Flutter doctor
[✓] Flutter (Channel master, 3.19.0-9.0.pre.206, on macOS 14.3 23D56 darwin-arm64, locale it-IT)
    • Flutter version 3.19.0-9.0.pre.206 on channel master at /Users/rafaelbenetton/Documents/Core/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e46394178 (8 ore fa), 2024-01-29 01:46:24 -0500
    • Engine revision 210ed1dfb8
    • Dart version 3.4.0 (build 3.4.0-82.0.dev)
    • DevTools version 2.31.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/rafaelbenetton/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Users/rafaelbenetton/Desktop/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/rafaelbenetton/Desktop/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.80.0

[✓] Connected device (3 available)
    • iPad 17.2 (mobile) • 96F06AA2-37BD-4212-9E6E-A6DB4C6601F9 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    • macOS (desktop)    • macos                                • darwin-arm64   • macOS 14.3 23D56 darwin-arm64
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 120.0.6099.234

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Troubleshooting

Ok so the problem is (i think) this package does not support Apple Silicon chip. Ok the solutions would be searching for xcode.app > "Get info" > and toggle "Open with Rosetta"

photo_2024-01-29_15-23-24 Well, I don't have this toggle so, by opening xcode instead of vscode (I build with vscode yes) and build the project a dialog shows up: photo_2024-01-29_15-23-01

Nice, let's build with Rosetta then! photo_2024-01-29_15-23-08

Hurray, you have a loop.

What I have to do?

blk-raffy avatar Jan 29 '24 14:01 blk-raffy

Same issue here

nicolamazz avatar Jan 31 '24 11:01 nicolamazz

@blk-raffy @nicolamazz What version of the Mapbox Maps Flutter Plugin do you use? I have no issues with it working on MBP with M1 Pro chip. @blk-raffy You flutter version is 3.19.0-9.0.pre.206, does it help if you switch back to the stable flutter version?

evil159 avatar Feb 01 '24 11:02 evil159

@evil159 I've switched the version of flutter hoping it was a solved issue. I've switched to the main branch and there is the issue there too. I think it's a mapbox related issue because I have another app with mapbox-gl (old flutter package) and it works fine.

I'm using the lastest version of mapbox

blk-raffy avatar Feb 01 '24 16:02 blk-raffy

Update, by doing flutter build ios the build works fine Screenshot 2024-02-03 alle 11 48 18

But if I start the emulator I get this: Screenshot 2024-02-03 alle 11 46 24

The problem is xcode or the emulator? (I think xcode only because the builded app won't boot, it's stucked into the splash screen)

blk-raffy avatar Feb 03 '24 10:02 blk-raffy

Had the exact same symptoms mentioned above on my M1 Pro, resolved it locally by following these steps:

Verifying the project's Podfile:

Previously, I had been using the Mapbox GL Flutter package and had updated my project's Podfile to address a past issue for M1 Macs (https://github.com/mapbox/mapbox-gl-native-ios/issues/487#issuecomment-901146551). I had previously updated my build settings to not target arm64, I reverted this change.

Original Configuration:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end

Reverted to:

post_install do |installer|
  installer.pods_project.targets.each do |target| 
    flutter_additional_ios_build_settings(target)
  end
end

Removing the Mapbox GL package (https://pub.dev/packages/mapbox_gl):

I was unable to run the simulator with the old Mapbox GL package still installed. Since I'm migrating to this package, I chose to remove it from my project:

  • Removed the old Mapbox GL package from my pubspec.yaml.
  • Deleted Podfile.lock in the iOS folder.
  • Ran flutter clean from the main project directory.
  • Ran flutter pub get from the main project directory.
  • Ran the project with the iPhone Simulator selected in VSCode.

This resolved the issue for me, I hope this helps!

JohnDMarsh avatar Mar 11 '24 09:03 JohnDMarsh