Undefined symbols for architecture i386: _FlutterMethodNotImplemented - ios

I am trying to run my flutter app on ios simulator which has few plugins such as connectivity, flutter_webview, fluttertoast etc.
When I am trying to run these I am getting following error on all of these plugins.
Undefined symbols for architecture i386:
"_FlutterMethodNotImplemented", referenced from:
-[FluttertoastPlugin handleMethodCall:result:] in FluttertoastPlugin.o
"_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
objc-class-ref in FluttertoastPlugin.o
Things are running smoothly on android.
I have tried
flutter clean
pod install
Still the error persists.
Anyone facing similar error? If anyone has solution to this please help me with this. Thanks
flutter doctor -v output
[✓] Flutter (Channel beta, v0.11.9, on Mac OS X 10.14.1 18B75, locale en-IN)
• Flutter version 0.11.9 at /Users/vipin/Downloads/soft/flutter
• Framework revision d48e6e433c (5 days ago), 2018-11-20 22:05:23 -0500
• Engine revision 5c8147450d
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /Users/vipin/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/vipin/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• ios-deploy 1.9.4
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 30.0.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] Connected device (1 available)
• iPhone XR • DAE7804F-C35A-4847-94AF-BC094BE584DC • ios • iOS 12.1 (simulator)
• No issues found!

If you're using app flavors and getting above error, have a look here

This error is related to Undefined symbols for architecture i386
This worked for me - for the target that reports warnings, change the "Valid Architecture" setting to:
$(VALID_ARCHS)
x86_64
P.S In case this doesn't help, go to Build Settings and search for "No Common Blocks" and set it to "No". Build and Run.

Related

I am getting this error "ld: framework not found Flutter" after upgrade xcode latest Version 13.4.1 (13F100). tried all solution but not succeed

This is the screenshot of error after running the app
Here is
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-arm, locale en-IN)
• Flutter version 3.0.2 at /Users/magespider/Developer/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cd41fdd495 (9 days ago), 2022-06-08 09:52:13 -0700
• Engine revision f15f824b57
• Dart version 2.17.3
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/magespider/Library/Android/sdk
• Platform android-32, build-tools 32.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/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 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.68.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.42.0
[✓] Connected device (2 available)
• macOS (desktop) • macOS • darwin-arm64 • macOS 12.4 21F79 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.115
! Error: Bhavin’s iPod is not connected. Xcode will continue when Bhavin’s iPod is connected. (code -13)
! Error: iPhone is busy: Waiting to connect and unlock the device. Xcode will continue when iPhone is finished. (code -10)
! Error: iPhone is not connected. Xcode will continue when iPhone is connected. (code -13)
! Error: Bhavin’s iPhone is not connected. Xcode will continue when Bhavin’s iPhone is connected. (code -13)
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Please help to resolve this issue, Thanks in advance
I tried the following solution
Deleted ios folder and then recreated
pod deintegrate, install
delete podfile, podfile.lock the Pods folder, and install the pod again.
tried to change the Other Linker Flag in Runner -> Build settings,
Added arm64 in Excluded Architecture.

iOS flutter app not running after updating device to iOS 14.7.1

After updating my iPhone 11 to iOS version 14.7.1, my flutter app is not launching anymore.
Steps already performed:
flutter clean
flutter pub get
flutter run
Also,
uninstalled and reinstalled the app
restarted the phone
output:
(base) Henrys-MacBook-Air:flutter henrycorreia$ flutter run
Running "flutter pub get" in flutter... 3.2s
Launching lib/main.dart on Henry’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXXXXXXXXX
Running pod install... 25.0s
Running Xcode build...
Xcode build done. 208.8s
Installing and launching... 58.4s
Error launching application on Henry’s iPhone.
==>> flutter doctor -v:
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.1 20G80 darwin-x64, locale en-GB)
• Flutter version 2.2.3 at /Users/henrycorreia/fvm/versions/2.2.3
• Framework revision f4abaa0735 (6 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/henr/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
✗ 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 at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/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 11.0.8+10-b944.6916264)
[✓] VS Code (version 1.59.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0
[✓] Connected device (3 available)
• Moto E 4 Plus (mobile) • xxxxxxxxx • android-arm • Android 7.1.1 (API 25)
• Henry’s iPhone (mobile) • xxxxxxxxxxxxxx • ios • iOS 14.7.1
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.131
! Doctor found issues in 1 category.
Is anybody facing the same issue? Any idea how to fix this?
Thank you
You have runtime error just before your first screen renders, try putting breakpoint in the first line of the main and debug line by line.
I was able to fix the issue. It seems to be a random issue that happens time to time when updating either the flutter version or iOS...
Here's how I fixed the issue:
==>> you can also get inspired by this thread: https://github.com/flutter/flutter/issues/72161
However, what worked for me was very simple as I am using vs code:
uninstalled the app
restarted the phone
open the app using Xcode
Product -> Clean Build Folder
Product -> Run
The app will launch correctly, then quit Xcode
After that, I run the app using vs code, and now it works as before.

flutter run error Command PhaseScriptExecution failed with a nonzero exit code but works with Xcode

whenever I'm trying to run flutter using VScode I get this error
** BUILD FAILED **
Xcode's output:
↳
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
Could not build the application for the simulator.
Error launching application on iPhone 12.
but it builds and runs with Xcode successfully.
my flutter doctor
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale
en-SA)
• Flutter version 2.2.3 at /Users/MJ/Development/Tools/flutter
• Framework revision f4abaa0735 (8 days ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
• Android SDK at /Users/MJ/Library/Android/sdk
• Platform android-30, build-tools 30.0.1
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/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 11.0.8+10-b944.6916264)
[✓] VS Code (version 1.58.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0
[✓] Connected device (4 available)
• MJs iPhone (mobile) • 00008101-0016114C3E10001E • ios
• iOS 14.6
• iPhone 12 (mobile) • E504D08A-A8D9-443E-AD19-D91C0EBFD823 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-x64
• macOS 11.4 20F71 darwin-x64
• Chrome (web) • chrome •
web-javascript • Google Chrome 91.0.4472.114
• No issues found!
I have tried deleting podfile and podfile.lock, tried flutter clean and flutter build iOS and flutter run all giving me the same error. but when I'm running or building with Xcode it builds fine with no errors.
please help it's been three weeks now reading the whole internet with now luck.

Build for iOS fails in Xcode 11

I change my iOS SDK to 14.0 from 13.4 then I try to build for ios but it fails when I try to build using 13.4. It doesn't show an error but I cannot upload the app it says error on the picture so needs to upgrade my SDK.
Here is my flutter --verbose:
[✓] Flutter (Channel stable, 2.0.5, on Mac OS X 10.15.3 19D76 darwin-x64, locale en-US)
• Flutter version 2.0.5 at /Users/fee/Documents/Developer/flutter
• Framework revision adc687823a (2 weeks ago), 2021-04-16 09:40:20 -0700
• Engine revision b09f014e96
• Dart version 2.12.3
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/fee/Library/Android/sdk
• Platform android-30, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
! Xcode 11.4.1 out of date (12.0.1 is recommended).
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93
And, here is the error shown
Error output from Xcode build:
2021-04-30 13:05:34.432 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
2021-04-30 13:05:34.610 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
2021-04-30 13:05:34.840 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
error: unknown error while handling message: unableToInitializeCore(errors: ["/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk:
error: SDK \'iphoneos14.0\' already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"])
I want your help to find where is this error comes from.
Your flutter doctor basically mentioned the problem for you:
Xcode 11.4.1 out of date (12.0.1 is recommended).
while Xcode 12 is required to build and upload to App Store. Update Xcode and try building again.

symbol(s) not found for architecture armv7 flutter

ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: dylib (/Users/Shared/store/build/ios/Release-iphoneos/abseil/absl.framework/absl) was built for newer iOS version (11.0) than being linked (10.0)
ld: warning: dylib (/Users/Shared/store/build/ios/Release-iphoneos/gRPC-C++/grpcpp.framework/grpcpp) was built for newer iOS version (11.0) than being linked (10.0)
ld: warning: dylib (/Users/Shared/store/build/ios/Release-iphoneos/leveldb-library/leveldb.framework/leveldb) was built for newer iOS version (11.0) than being linked (10.0)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.
[✓] Flutter (Channel stable, 2.0.0, on Mac OS X 10.15.4 19E266
darwin-x64, locale en-IN)
• Flutter version 2.0.0 at /Applications/flutter2.0_midhilaj
• Framework revision 60bd88df91 (4 weeks ago), 2021-03-03 09:13:17 -0800
• Engine revision 40441def69
• Dart version 2.12.0
[!] Android toolchain - develop for Android devices (Android SDK
version 30.0.3)
• Android SDK at /Users/midhilajm/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Users/midhilajm/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/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 1.8.0_242-release-1644-b3-6915495)
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio 2.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 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.54.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90
! Error: Midhilaj’s iPhone is not connected. Xcode will continue when Midhilaj’s iPhone is connected. (code -13)
! Doctor found issues in 1 category.
Run flutter upgrade to upgrade to most recent version of Flutter. After that, flutter clean and build again. This should solve your problem.
Only thing which solved me this problem is to clear the pub cache by deleting pubspec.lock file and re running flutter run command.
This mainly happens due to the error in the cached plugin files

Resources