Skip to content

can not run in device , can only run in simulator with official article https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#ios  #38746

Closed

Description

@imfaker

Steps to Reproduce

  1. II follow the instructions of the official article about Add-Flutter-to-existing-apps (https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#ios)
  2. when I finish , I can run it on the simulator , in my orginal iOS project
  3. but if I add plugin in dart , like cached_network_image: ^1.1.1
    , I can not run it on the device or release mode , only can run in simulator with debug mode , it has compile error .

Logs

this is Xcode compile error

Ld /Users/fuxiaoquan/Library/Developer/Xcode/DerivedData/VpnMaster-gcxshtzmsgkvuledmnwyiqcfsdba/Build/Products/Debug-iphoneos/path_provider/path_provider.framework/path_provider normal arm64
    cd /Users/fuxiaoquan/Desktop/beginFromBegin/VpnMaster/Pods
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk -L/Users/fuxiaoquan/Library/Developer/Xcode/DerivedData/VpnMaster-gcxshtzmsgkvuledmnwyiqcfsdba/Build/Products/Debug-iphoneos/path_provider -F/Users/fuxiaoquan/Library/Developer/Xcode/DerivedData/VpnMaster-gcxshtzmsgkvuledmnwyiqcfsdba/Build/Products/Debug-iphoneos/path_provider -F/Users/fuxiaoquan/Desktop/beginFromBegin/VpnMaster/Pods/../../vpnmaster_flutter/.ios/Flutter/engine -filelist /Users/fuxiaoquan/Library/Developer/Xcode/DerivedData/VpnMaster-gcxshtzmsgkvuledmnwyiqcfsdba/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/path_provider.build/Objects-normal/arm64/path_provider.LinkFileList -install_name @rpath/path_provider.framework/path_provider -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=8.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/fuxiaoquan/Library/Developer/Xcode/DerivedData/VpnMaster-gcxshtzmsgkvuledmnwyiqcfsdba/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/path_provider.build/Objects-normal/arm64/path_provider_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -framework Foundation -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/fuxiaoquan/Library/Developer/Xcode/DerivedData/VpnMaster-gcxshtzmsgkvuledmnwyiqcfsdba/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/path_provider.build/Objects-normal/arm64/path_provider_dependency_info.dat -o /Users/fuxiaoquan/Library/Developer/Xcode/DerivedData/VpnMaster-gcxshtzmsgkvuledmnwyiqcfsdba/Build/Products/Debug-iphoneos/path_provider/path_provider.framework/path_provider

ld: warning: Could not find auto-linked framework 'Flutter'
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FlutterStandardTypedData", referenced from:
      objc-class-ref in SqflitePlugin.o
  "_OBJC_CLASS_$_FlutterError", referenced from:
      objc-class-ref in SqflitePlugin.o
  "_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
      objc-class-ref in SqflitePlugin.o
  "_FlutterMethodNotImplemented", referenced from:
      -[SqflitePlugin handleMethodCall:result:] in SqflitePlugin.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[✓] Flutter (Channel master, v1.9.1-pre.59, on Mac OS X 10.14.6 18G87, locale
    zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Android Studio (version 3.4)
[✓] Connected device (2 available)

what should I do ? can run in device or release mode?

Activity

  1. changed the title [-]https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#ios [/-] [+]can not run in device , can only run in simulator, https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#ios [/+] on Aug 17, 2019
  2. changed the title [-]can not run in device , can only run in simulator, https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#ios [/-] [+]can not run in device , can only run in simulator with official article https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#ios [/+] on Aug 17, 2019
  3. jmagman commented on Aug 19, 2019

    @jmagman
    Member

    Flutter is not currently supported on the simulator in profile or release mode. You should be able to run build configurations on a real device, though.

    Are you running from your app's xcworkspace? CocoaPods will create a xcworkspace (if one doesn't already exist) and add the plugin targets there.

  4. added
    a: existing-appsIntegration with existing apps via the add-to-app flow
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 19, 2019
  5. imfaker commented on Aug 20, 2019

    @imfaker
    Author

    Flutter is not currently supported on the simulator in profile or release mode. You should be able to run build configurations on a real device, though.

    Are you running from your app's xcworkspace? CocoaPods will create a xcworkspace (if one doesn't already exist) and add the plugin targets there.

    I am running very well in simulator ,but can not running in device.
    And I use cocoapods and add the plugin targets there , follow (https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#ios)

  6. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 20, 2019
  7. jmagman commented on Aug 20, 2019

    @jmagman
    Member

    Can you confirm you are running from your original app's .xcworkspace that contains the Pods project and not the .xcodeproj?

  8. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 20, 2019
  9. jmagman commented on Aug 20, 2019

    @jmagman
    Member

    And confirm that you ran pod install?

  10. imfaker commented on Aug 21, 2019

    @imfaker
    Author

    And confirm that you ran pod install?

    yes I am sure。If I did not do this , I can not runing in simulator .`
    屏幕快照 2019-08-21 上午8 05 22
    屏幕快照 2019-08-21 上午8 05 15
    this is my pod project

    `

  11. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 21, 2019
  12. jmagman commented on Aug 21, 2019

    @jmagman
    Member

    yes I am sure。If I did not do this , I can not runing in simulator .`

    Very fair point 😀

    I am just trying to figure out why the arm* architecture Flutter framework isn't found in the search paths because I am not able to reproduce on Channel master, v1.9.2-pre.41. I can run on a device and the simulator in Debug with sqflite plugin, etc. And I see Flutter in your Development Pods...

    Whenever you change the Flutter plugin dependencies in some/path/my_flutter/pubspec.yaml, you need to run flutter packages get from some/path/my_flutter to refresh the list of plugins read by the podhelper.rb script. Then run pod install again from some/path/MyApp.

    but you did that I assume since it's working from the simulator...

    Are you able to make a test app that reproduces this?

  13. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 21, 2019
  14. dntzee commented on Aug 23, 2019

    @dntzee

    I have the same error,I follow the instructions of the official article about Add-Flutter-to-existing-apps (https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#ios).

    Everything works fine, when I add these dependencies to the pubspec.yaml file,

    iOS won't run on the device,

    it can only run in the simulator.

    cupertino_icons: '0.1.2' dio: '2.1.13' path_provider: '1.2.0' dio_flutter_transformer: '2.0.10' page_transition: '1.1.4' flutter_easyrefresh: '1.2.7' fluro: '1.5.1' event_bus: '1.1.0' image_picker: '0.4.12+1' flutter_screenutil: '0.5.3' fluttertoast: '^2.2.11' video_player: '0.9.0' audioplayer: #^0.5.2 cached_network_image: '1.1.1' shared_preferences: '0.5.3+4' flutter_html: '0.10.4' flutter_webview_plugin: '0.3.2'

  15. 6 remaining items

  16. leielyq commented on Aug 28, 2019

    @leielyq

    @imfaker 你弄好了吗

  17. imfaker commented on Aug 29, 2019

    @imfaker
    Author

    后面我反正用了其它方法 解决, 这个 问题可能原因 ,是你的 flutter 引擎可能对不上, 如果你的 flutter。framework 是别人 发给你的,不是自己生成的 ,检查下两边的对应库版本是不是 一样 ,都是master channel。然后还有可能 就是我也不知道是 bug 还是 什么原因,你再试试重新 flutter clean生成新的试试。 周末我可能会找下具体的原因,现在这个问题我是偶尔出现 ,有时候又好。

    (I used other methods to solve it later. The possible cause of this problem is that your flutter engine may not be right if you have flutter. The framework is sent to you by others, not generated by yourself. Check whether the corresponding library versions on the next two sides are the same, both are master channels. Then there is probably that I don't know if it's a bug or what, you try to re-flutter clean to generate a new one. I may find a specific reason for the weekend. Now I have occasional problems, sometimes good.)

  18. imfaker commented on Aug 29, 2019

    @imfaker
    Author

    @imfaker Did you mean to close this?

    no, I solve this problen in other way , and I think I would found reason in this weekend ,

  19. jmagman commented on Aug 29, 2019

    @jmagman
    Member

    Yes, you need the same version of the framework that corresponds to the version of Flutter you have installed.
    @leielyq is that your issue, too?

  20. leielyq commented on Aug 29, 2019

    @leielyq

    Yes, you need the same version of the framework that corresponds to the version of Flutter you have installed.
    @leielyq is that your issue, too?

    I know! My project have path_provider and sqflite . And them has this.
    then,I new project,And remove path_provider and sqflite .this is OK!
    I speack english a little.

  21. leielyq commented on Aug 29, 2019

    @leielyq

    Yes, you need the same version of the framework that corresponds to the version of Flutter you have installed.
    @leielyq is that your issue, too?

    I know! My project have path_provider and sqflite . And them has this.
    then,I new project,And remove path_provider and sqflite .this is OK!
    I speack english a little.

    I discover oc and swift project, flutter no work

  22. leielyq commented on Aug 29, 2019

    @leielyq

    Yes, you need the same version of the framework that corresponds to the version of Flutter you have installed.
    @leielyq is that your issue, too?

    I know! My project have path_provider and sqflite . And them has this.
    then,I new project,And remove path_provider and sqflite .this is OK!
    I speack english a little.

    I discover oc and swift project, flutter no work

    But,my project use a lot of path_provider,sad

  23. leielyq commented on Aug 29, 2019

    @leielyq

    后面我反正用了其它方法 解决, 这个 问题可能原因 ,是你的 flutter 引擎可能对不上, 如果你的 flutter。framework 是别人 发给你的,不是自己生成的 ,检查下两边的对应库版本是不是 一样 ,都是master channel。然后还有可能 就是我也不知道是 bug 还是 什么原因,你再试试重新 flutter clean生成新的试试。 周末我可能会找下具体的原因,现在这个问题我是偶尔出现 ,有时候又好。

    可能看一下你的path_provider版本吗

  24. imfaker commented on Aug 31, 2019

    @imfaker
    Author

    后面我反正用了其它方法 解决, 这个 问题可能原因 ,是你的 flutter 引擎可能对不上, 如果你的 flutter。framework 是别人 发给你的,不是自己生成的 ,检查下两边的对应库版本是不是 一样 ,都是master channel。然后还有可能 就是我也不知道是 bug 还是 什么原因,你再试试重新 flutter clean生成新的试试。 周末我可能会找下具体的原因,现在这个问题我是偶尔出现 ,有时候又好。

    可能看一下你的path_provider版本吗

    你报的什么错

  25. shawn736 commented on Sep 17, 2019

    @shawn736

    Undefined symbols for architecture arm64:
    "OBJC_CLASS$_FlutterMethodChannel", referenced from:
    objc-class-ref in PathProviderPlugin.o
    "_FlutterMethodNotImplemented", referenced from:
    ___47+[FLTPathProviderPlugin registerWithRegistrar:]_block_invoke in PathProviderPlugin.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Using the "stable" branch of the Flutter SDK, I have same error only on the real device. When I change to the "master" branch, it both works on the device and simulator.

  26. jmagman commented on Sep 17, 2019

    @jmagman
    Member

    后面我反正用了其它方法 解决, 这个 问题可能原因 ,是你的 flutter 引擎可能对不上, 如果你的 flutter。framework 是别人 发给你的,不是自己生成的 ,检查下两边的对应库版本是不是 一样 ,都是master channel。然后还有可能 就是我也不知道是 bug 还是 什么原因,你再试试重新 flutter clean生成新的试试。 周末我可能会找下具体的原因,现在这个问题我是偶尔出现 ,有时候又好。

    The issue reported by the originator is that their version of the Flutter.framework did not match the version of Flutter that compiled their dart code (assuming I'm translating correctly). This is expected behavior since there is not guaranteed binary compatibility between different versions of dart. So I'm going to close this issue.

    Anyone else with a similar linker error on a real device and not the simulator, should file a new issue and link to this one if:

    1. You are on the master channel and have run flutter upgrade. Add-to-app must be run from the master channel. See https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#intro.
    2. You have run flutter clean.
    3. You didn't get Flutter.framework from somewhere other than the version that was downloaded on your machine with the flutter tools (the originator's issue).

    A sample app reproducing the issue is always appreciated as well.

    Thanks!

  27. github-actions commented on Aug 27, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  28. locked as resolved and limited conversation to collaborators on Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: existing-appsIntegration with existing apps via the add-to-app flow

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions