Flutter Braintree not working in Apple M1 - flutter

I am having issues while compiling Flutter Braintree in Apple M1.
I even tried creating a new project only with flutter_braintree 2.2.0, still doesn't compile.
Attached is the flutter doctor and logs of the project.
Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-arm, locale en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc5)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.61.2)
[✓] Connected device (2 available)
• No issues found!
Logs
Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install...
Running Xcode build...
Xcode build done. 6.8s
Failed to build iOS app
Error output from Xcode build:
↳
objc[95440]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x1da8cf130) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x107bc02c8). One of the two will be used. Which one is undefined.
objc[95440]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x1da8cf180) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x107bc0318). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
/Users/project/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-2.2.0/ios/Classes/FlutterBraintreeDropInPlugin.swift:163:121: warning: expression implicitly coerced from 'String?' to 'Any'
flutterResult(["paymentMethodNonce": buildPaymentNonceDict(nonce: result?.paymentMethod), "deviceData": deviceData])
^~~~~~~~~~
/Users/project/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-2.2.0/ios/Classes/FlutterBraintreeDropInPlugin.swift:163:121: note: provide a default value to avoid this warning
flutterResult(["paymentMethodNonce": buildPaymentNonceDict(nonce: result?.paymentMethod), "deviceData": deviceData])
^~~~~~~~~~
?? <#default value#>
/Users/project/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-2.2.0/ios/Classes/FlutterBraintreeDropInPlugin.swift:163:121: note: force-unwrap the value to avoid this warning
flutterResult(["paymentMethodNonce": buildPaymentNonceDict(nonce: result?.paymentMethod), "deviceData": deviceData])
^~~~~~~~~~
!
/Users/project/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-2.2.0/ios/Classes/FlutterBraintreeDropInPlugin.swift:163:121: note: explicitly cast to 'Any' with 'as Any' to silence this warning
flutterResult(["paymentMethodNonce": buildPaymentNonceDict(nonce: result?.paymentMethod), "deviceData": deviceData])
^~~~~~~~~~
as Any
Command CompileSwiftSources failed with a nonzero exit code
/Users/project/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-2.2.0/ios/Classes/BaseFlutterBraintreePlugin.swift:3:8: error: could not find module 'Braintree' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64, at: /Users/project/Developer/testing_braintree/build/ios/Debug-iphonesimulator/Braintree/Braintree.framework/Modules/Braintree.swiftmodule
import Braintree
^
/Users/project/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-2.2.0/ios/Classes/BaseFlutterBraintreePlugin.swift:3:8: error: could not find module 'Braintree' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64, at: /Users/project/Developer/testing_braintree/build/ios/Debug-iphonesimulator/Braintree/Braintree.framework/Modules/Braintree.swiftmodule
import Braintree
^
/Users/project/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-2.2.0/ios/Classes/BaseFlutterBraintreePlugin.swift:3:8: error: could not find module 'Braintree' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64, at: /Users/project/Developer/testing_braintree/build/ios/Debug-iphonesimulator/Braintree/Braintree.framework/Modules/Braintree.swiftmodule
import Braintree
^
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Could not build the application for the simulator.
Error launching application on iPhone 13.

Add this code on the Podfile,
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
And from Xcode pass to build iOS 9.0 to 12.0

Related

Could not build the precompiled application for the device. Error launching application on Adaptabiz's iPad

When I remove Razorpay and run the code, it works fine. But when I install Razorpay, it throws this error. It used to work normally previously even after razorpay integration, but it suddenly started throwing this error. I was not able to run the app in ios Simulator through vs code. I was able to run my code in ios simulators through xcode. But now i can't run my code from both vscode and xcode.
Here is my Error Log
Launching lib/main.dart on Adaptabiz's iPad in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: Y2NZK7M69V
Xcode build done. 31.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/gourav/Desktop/VideoTailorClient app/ios/Pods/razorpay-pod/Pod/Razorpay.framework/Modules/Razorpay.swiftmodule/arm64-apple-ios.swiftinterface:12:8: error: no such module '_Concurrency'
import _Concurrency
^
/Users/gourav/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/razorpay_flutter-1.2.7/ios/Classes/RazorpayDelegate.swift:2:8: error: failed to build module 'Razorpay' from its module interface; the compiler that produced it, 'Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)'
import Razorpay
^
/Users/gourav/Desktop/VideoTailorClient app/ios/Pods/razorpay-pod/Pod/Razorpay.framework/Modules/Razorpay.swiftmodule/arm64-apple-ios.swiftinterface:12:8: error: no such module '_Concurrency'
import _Concurrency
^
/Users/gourav/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/razorpay_flutter-1.2.7/ios/Classes/RazorpayDelegate.swift:2:8: error: failed to build module 'Razorpay' from its module interface; the compiler that produced it, 'Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)'
import Razorpay
^
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'FMDB' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'OrderedSet' from project 'Pods')
Could not build the precompiled application for the device.
Error launching application on Adaptabiz's iPad.
Exited (sigterm)
this is the result of flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.0, on Mac OS X 10.15.7 19H1417 darwin-x64, locale en-SG)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.63.0)
[✓] Connected device (2 available)
! Error: Adaptabiz's iPad is busy: Copying cache files from device. Xcode will continue when Adaptabiz's iPad is finished. (code -10)
• No issues found!
Try updating your flutter,Xcode and Razorpay versions to latest available... This Worked for me.

Flutter: fatal error: 'Flutter/Flutter.h' file not found

Xcode's output: ↳
In file included from /Users/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.m:5:
/Users/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
flutter doctor:
[✓] Flutter (Channel stable, 2.0.5, on macOS 11.2.3 20D91
darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android
SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (3 available)
• No issues found!
I tried all solutions proposed here without luck:
https://github.com/flutter/flutter/issues/16036
All dependencies updated
This is a matter of finding a library on our app that doesn't support null safety. We can do several things after identify it:
Ask on its repo to get support for null safety
Use a different library that supports this
Try to fix it ourselves
stackoverflow.com/a/33509278/4858133
I believe you should try both of this steps:
1- Try to remove pod files and install them again by executing:
$ cd ios/
$ pod deintegrate
$ pod install
2- Clean workplace by executing command on the root of the project:
$ flutter clean
Then try to run the app again.

fatal error: 'Flutter/Flutter.h' file not found running on MabookBook M1

I already tried all of this link and nothing
Xcode build done. 4,3s
Failed to build iOS app
Error output from Xcode build:
↳
objc[22045]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1ffbaf8f0) and ?? (0x11b1602b8). One of the two will be used. Which one is undefined.
objc[22045]: Class AMSupportURLSession is implemented in both ?? (0x1ffbaf940) and ?? (0x11b160308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/netolobo/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.28/ios/Classes/FLTPathProviderPlugin.m:5:
/Users/netolobo/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.28/ios/Classes/FLTPathProviderPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.1.0-13.0.pre.499, on macOS 11.1 20C69 darwin-arm, locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (2 available)
• No issues found!
I finally found the final solution!
Backup ios/Runner folder.
Delete the ios folder.
Run flutter create . in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!

Flutter build failed with fatal error: 'Flutter/Flutter.h' file not found

I am developing the app with flutter,
I am getting fatal error: 'Flutter/Flutter.h' file not found , this error when I build my app.
I tried reinstall cocoapod and delete podfile.lock and reinstalled it,
but I am still getting this error..
what can I do for this error ?
daegilpyo#DAEGILs-MacBook-Pro eminail % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B50 darwin-x64, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
[✓] Android Studio (version 3.6)
[✓] Connected device (1 available)
• No issues found!
daegilpyo#DAEGILs-MacBook-Pro eminail %
vent sent after app closed: {id: 0, progressId: null, finished: true}
Launching lib/main.dart on DAEGIL의 iPhone in debug mode...
lib/main.dart:1
Automatically signing iOS for device deployment using specified development team in Xcode project: T6ULPGT4J7
Xcode build done. 18.9s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Command CompileSwift failed with a nonzero exit code
In file included from /Users/daegilpyo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.10/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/daegilpyo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.10/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
go to terminal, backup your ios/Runner folder and delete your ios folder. Then go to terminal and execute
cd path/to/your/project/projectName
flutter create .
flutter run
if flutter run fails
cd ios
pod install
cd ..
flutter run

Flutter iOS Simulation keep having failed Xcode build

Just installed Flutter but Flutter keep failing to open up a fresh project in iOS Simulator
Error in Terminal
Running Xcode build...
└─Compiling, linking and signing... 2.2s
Xcode build done. 16.0s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
ld: unknown option: -target
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro.
Tried Flutter Clean but it doesn't work.
I ran Flutter Doctor but everything seems fine.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.6 19G73, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.47.3)
[✓] Connected device (1 available)
• No issues found!
Please help.
Update 1 Aug
Ran flutter run -v and here's the result. Still I can't start the file from flutter run. However, Xcode could build and run the file fine. Same goes to Android Studio.
[ +37 ms] Failed to build iOS app
[ ] Error output from Xcode build:
↳
[ ] ** BUILD FAILED **
The following build commands failed:
Ld
/Users/jason/Develop/first/build/ios/Debug-iphonesimulator/Runner.app/Runne
r normal x86_64
(1 failure)
[ ] Xcode's output:
↳
[ +56 ms] Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
-configuration Debug VERBOSE_SCRIPT_LOGGING=YES -workspace
Runner.xcworkspace -scheme Runner
BUILD_DIR=/Users/jason/Develop/first/build/ios -sdk
iphonesimulator
-arch x86_64
SCRIPT_OUTPUT_STREAM_FILE=/var/folders/1n/fywsxx0j35g060rtr5b9ff9c0000gn
/T/flutter_build_log_pipe.KUbRcA/pipe_to_stdout
FLUTTER_SUPPRESS_ANALYTICS=true
COMPILER_INDEX_STORE_ENABLE=NO
Build settings from command line:
ARCHS = x86_64
BUILD_DIR = /Users/jason/Develop/first/build/ios
COMPILER_INDEX_STORE_ENABLE = NO
FLUTTER_SUPPRESS_ANALYTICS = true
SCRIPT_OUTPUT_STREAM_FILE =
/var/folders/1n/fywsxx0j35g060rtr5b9ff9c0000gn/T/flutter_build_log_pipe.
KUbRcA/pipe_to_stdout
SDKROOT = iphonesimulator13.6
VERBOSE_SCRIPT_LOGGING = YES
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
ProcessProductPackaging ""
Anyone got any clue what's happening?
Nevermind. I can't figure out why. Wiped my HD and reinstalled macOS Catalina, Xcode and now it works.