Flutter - google_sign_in 为 iOS Simulator-x86_64 构建,但尝试链接为 iOS Simulator-arm64 构建的文件 [重复]
Posted
技术标签:
【中文标题】Flutter - google_sign_in 为 iOS Simulator-x86_64 构建,但尝试链接为 iOS Simulator-arm64 构建的文件 [重复]【英文标题】:Flutter - google_sign_in building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64 [duplicate] 【发布时间】:2022-01-19 08:09:39 【问题描述】:我正在尝试使用 google_sign_in
颤振插件运行我的 auth-sample
项目,但它不会编译。
这是我面临的错误:
Launching lib/main.dart on iPhone 12 in debug mode...
Running pod install...
Running Xcode build...
Xcode build done. 10.9s
Failed to build ios app
Error output from Xcode build:
↳
objc[43499]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1fafd6b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1066b82c8). One of the two will be used. Which one is undefined.
objc[43499]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1fafd6be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1066b8318). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/AppAuth/AppAuth.framework/AppAuth, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/PromisesObjC/FBLPromises.framework/FBLPromises, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/FirebaseAuth/FirebaseAuth.framework/FirebaseAuth, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/FirebaseCore/FirebaseCore.framework/FirebaseCore, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/FirebaseCoreDiagnostics/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/GTMSessionFetcher/GTMSessionFetcher.framework/GTMSessionFetcher, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/GTMAppAuth/GTMAppAuth.framework/GTMAppAuth, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/GoogleDataTransport/GoogleDataTransport.framework/GoogleDataTransport, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/GoogleUtilities/GoogleUtilities.framework/GoogleUtilities, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/firebase_auth/firebase_auth.framework/firebase_auth, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/firebase_core/firebase_core.framework/firebase_core, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/Pods_Runner.framework/Pods_Runner, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file /Users/myuser/Projects/test/auth_sample/build/ios/Debug-iphonesimulator/nanopb/nanopb.framework/nanopb, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GTMOAuth2KeychainCompatibility", referenced from:
objc-class-ref in GoogleSignIn(GIDAuthStateMigration_bdf842e92d17b12b5f020e0e721bd017.o)
"_OBJC_CLASS_$_OIDURLQueryComponent", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
"_OBJC_CLASS_$_GTMSessionFetcher", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
"_OBJC_CLASS_$_OIDServiceConfiguration", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
"_OIDResponseTypeCode", referenced from:
-[GIDSignIn authenticateInteractivelyWithOptions:] in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
"_OBJC_CLASS_$_OIDAuthorizationService", referenced from:
objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
"_OIDOAuthErrorResponseErrorKey", referenced from:
+[GIDAuthentication handleTokenFetchEMMError:completion:] in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
"_OBJC_CLASS_$_OIDIDToken", referenced from:
objc-class-ref in GoogleSignIn(GIDGoogleUser_2bdd4a676c033bc6ca21970e75d9159c.o)
objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
"_OBJC_METACLASS_$_GTMAppAuthFetcherAuthorization", referenced from:
_OBJC_METACLASS_$_GTMAppAuthFetcherAuthorizationWithEMMSupport in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
(maybe you meant: _OBJC_METACLASS_$_GTMAppAuthFetcherAuthorizationEMMChainedDelegate, _OBJC_METACLASS_$_GTMAppAuthFetcherAuthorizationWithEMMSupport )
"_OBJC_CLASS_$_GTMAppAuthFetcherAuthorization", referenced from:
_OBJC_CLASS_$_GTMAppAuthFetcherAuthorizationWithEMMSupport in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
objc-class-ref in GoogleSignIn(GIDAuthStateMigration_bdf842e92d17b12b5f020e0e721bd017.o)
(maybe you meant: _OBJC_CLASS_$_GTMAppAuthFetcherAuthorizationEMMChainedDelegate, _OBJC_CLASS_$_GTMAppAuthFetcherAuthorizationWithEMMSupport )
"_OIDOAuthTokenErrorDomain", referenced from:
___46-[GIDAuthentication refreshTokensWithHandler:]_block_invoke in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
"_OBJC_CLASS_$_GTMKeychain", referenced from:
objc-class-ref in GoogleSignIn(GIDAuthStateMigration_bdf842e92d17b12b5f020e0e721bd017.o)
"_OBJC_CLASS_$_OIDAuthState", referenced from:
objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
"_OBJC_CLASS_$_OIDAuthorizationRequest", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
"_OBJC_CLASS_$_FLTFirebaseCorePlugin", referenced from:
objc-class-ref in GeneratedPluginRegistrant.o
"_OBJC_CLASS_$_FLTFirebaseAuthPlugin", referenced from:
objc-class-ref in GeneratedPluginRegistrant.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
/Users/myuser/Projects/test/auth_sample/ios/Runner.xcodeproj: warning: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 12.
我有一台采用 M1 架构的 mac mini 2020,我正在运行最新版本的 xcode 13。
似乎某些库无法针对 arm 架构进行编译,并且由于 iPhone 模拟器使用该架构,因此构建失败。
我还设置了 project.pbxproj
文件以排除 9386 和 arm64 架构:
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
您对如何解决这个问题有任何想法吗?当我集成 google_sign_in
依赖项时,这个问题就开始了。
更新:
flutter doctor -v
的结果:
~/Projects/test/auth_sample: flutter doctor
[✓] Flutter (Channel stable, 2.8.0, on macOS 12.1 21C52 darwin-arm, locale en-IT)
• Flutter version 2.8.0 at /Users/myuser/Src/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cf44000065 (7 days ago), 2021-12-08 14:06:50 -0800
• Engine revision 40a99c5951
• Dart version 2.15.0
[✓] android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/myuser/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Users/myuser/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Users/myuser/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/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.10+0-b96-7249189)
[✓] Android Studio (version 2020.3)
• Android Studio at /Users/myuser/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/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.10+0-b96-7249189)
[☠] IntelliJ IDEA Ultimate Edition (the doctor check crashed)
✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
✗ FormatException: Unexpected extension byte (at offset 5)
• #0 _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
#1 Utf8Decoder.convert (dart:convert/utf.dart:318:42)
#2 InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
#3 new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
#4 ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
#5 ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
#6 IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
#7 IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
#8 IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
#9 IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
#10 asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
#11 asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
#12 _rootRun (dart:async/zone.dart:1428:13)
#13 _CustomZone.run (dart:async/zone.dart:1328:19)
#14 _runZoned (dart:async/zone.dart:1863:10)
#15 runZonedGuarded (dart:async/zone.dart:1851:12)
#16 runZoned (dart:async/zone.dart:1782:12)
#17 asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
#18 Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:197:9)
#19 Doctor.diagnose (package:flutter_tools/src/doctor.dart:301:47)
#20 DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:47)
#21 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1290:12)
<asynchronous suspension>
#22 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1140:27)
<asynchronous suspension>
#23 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#24 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#25 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
<asynchronous suspension>
#26 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#27 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
<asynchronous suspension>
#28 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#29 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#30 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3)
• IntelliJ at /Users/myuser/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ IDEA.app
• 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
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.3)
• IntelliJ at /Users/myuser/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/212.5457.46/IntelliJ IDEA.app
• Flutter plugin version 61.2.4
• Dart plugin version 212.5486
[✓] VS Code (version 1.63.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.29.0
[✓] Connected device (2 available)
• iPhone 12 (mobile) • 9B4C7C94-F3AA-4370-820E-5CEAF6E0AA18 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.110
【问题讨论】:
运行颤振医生并附上它。 更新@gretal 这里是讨论:***.com/questions/63607158/… 【参考方案1】:我来解决这个问题:
扑干净 颤振酒吧获取 cd ios arch -x86_64 pod 更新【讨论】:
但是在解决了这个问题之后我仍然发现了 google_sign_in 的新问题以上是关于Flutter - google_sign_in 为 iOS Simulator-x86_64 构建,但尝试链接为 iOS Simulator-arm64 构建的文件 [重复]的主要内容,如果未能解决你的问题,请参考以下文章
使用 google_sign_in Flutter 刷新令牌获取新令牌
Flutter Firebase Auth / Google_sign_in 无法使用 statuscode=CANCELED 登录
Flutter web google_sign_in:如何检索refreshToken
如何在 Flutter 的 google_sign_in 中获取 JWT 格式的访问令牌?