Error when 'flutter run': Undefined symbols for architecture arm64:

2,796 阅读1分钟

这是一篇求助帖!

我在flutter项目中运行 'flutter run'得到以下错误:

charlesdeMBP:rongchang_app charles$ flutter run
Launching lib/main.dart on yueji的 iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: G5JFP3Y63E
Running pod install...                                              2.8s
Running Xcode build...                                                  
                                                   
Xcode build done.                                           10.2s
Failed to build iOS app
Error output from Xcode build:
↳
    2019-10-03 18:01:56.053 xcodebuild[60982:3066650]  DTDeviceKit: deviceType from 43905bacecbd9af724d1c568192bbbe425c383b4 was NULL
    2019-10-03 18:01:56.115 xcodebuild[60982:3066698]  DTDeviceKit: deviceType from 43905bacecbd9af724d1c568192bbbe425c383b4 was NULL
    ** BUILD FAILED **


Xcode's output:
↳
    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_FlutterStandardMessageCodec", referenced from:
          objc-class-ref in FlutterWebView.o
      "_OBJC_CLASS_$_FlutterError", referenced from:
          objc-class-ref in FLTWKNavigationDelegate.o
          objc-class-ref in FlutterWebView.o
      "_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
          objc-class-ref in FLTCookieManager.o
          objc-class-ref in FlutterWebView.o
      "_FlutterMethodNotImplemented", referenced from:
          -[FLTCookieManager handleMethodCall:result:] in FLTCookieManager.o
          ___83-[FLTWKNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]_block_invoke in FLTWKNavigationDelegate.o
          -[FLTWebViewController onMethodCall:result:] in FlutterWebView.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build systemnote: Planning buildnote: Constructing build description

Could not build the precompiled application for the device.

Error launching application on yueji的 iPhone.

这个错误应该不是FlutterWebView插件的原因,因为我在项目中依赖了多个库,去掉FlutterWebView之后再运行又会报同样的错误,但是是其他库。

flutter doctor -v:

[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.14.6 18G95, locale zh-Hans-CN)
    • Flutter version 1.9.1+hotfix.4 at /Users/charles/development/flutter
    • Framework revision cc949a8e8b (6 days ago), 2019-09-27 15:04:59 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/charles/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, 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 11.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.0, Build version 11A420a
    • CocoaPods version 1.8.0

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 39.0.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

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

[✓] Connected device (1 available)
    • yueji的 iPhone • 43905bacecbd9af724d1c568192bbbe425c383b4 • ios • iOS 12.4.1

• No issues found!

十分感谢各位大佬帮助!