Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running flutter run while embedding a Unity Project with Vuforia as its AR Framework #314

Open
Badjessa-git opened this issue Feb 7, 2021 · 5 comments
Labels

Comments

@Badjessa-git
Copy link

Describe the bug
I have been unable to use Vuforia with the plugin on a ios. I followed all the instructions to install.

`(lldb) dyld: dependent dylib '@rpath/ARFoundationDriver.framework/ARFoundationDriver' not found for '/private/var/containers/Bundle/Application/EB7A6FE8-16A5-4A7E-A3C1-DC1953015CC5/Runner.app/Frameworks/UnityFramework.framework/UnityFramework', tried but didn't find: '/private/var/containers/Bundle/Application/EB7A6FE8-16A5-4A7E-A3C1-DC1953015CC5/Runner.app/Frameworks/ARFoundationDriver.framework/ARFoundationDriver' '/usr/lib/swift/ARFoundationDriver.framework/ARFoundationDriver' '@rpath/ARFoundationDriver.framework/ARFoundationDriver' '/System/Library/Frameworks/ARFoundationDriver.framework/ARFoundationDriver'

  • thread iOS Support #1, stop reason = signal SIGABRT
    frame #0: 0x00000001048cf440 dyld__abort_with_payload + 8 dyld__abort_with_payload:
    -> 0x1048cf440 <+8>: b.lo 0x1048cf460 ; <+40>
    0x1048cf444 <+12>: pacibsp
    0x1048cf448 <+16>: stp x29, x30, [sp, #-0x10]!
    0x1048cf44c <+20>: mov x29, sp
    Target 0: (Runner) stopped. `

I tried adding Vuforia for iOS using instructions here https://library.vuforia.com/articles/Solution/Getting-Started-with-Vuforia-for-iOS-Development.html as a framework to the Runner without any success. Any help here would be greatly appreciated

Xcode 12.0

flutter doctor -v
`[✓] Flutter (Channel master, 1.26.0-13.0.pre.141, on macOS 11.1 20C69 darwin-x64, locale en-US)
• Flutter version 1.26.0-13.0.pre.141 at /Users/romeobahoumda/flutter
• Framework revision f9a8c86d79 (2 weeks ago), 2021-01-23 15:04:04 -0500
• Engine revision fdddf87080
• Dart version 2.12.0 (build 2.12.0-253.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/romeobahoumda/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• 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)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• 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)

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

[✓] Connected device (2 available)
• iPhone (mobile) • 00008030-001824D01AD8802E • ios • iOS 14.3
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.146

• No issues found!`

Smartphone (please complete the following information):

  • Device: iPhone 11 iOS 14.0

Additional context
Add any other context about the problem here.

@Badjessa-git Badjessa-git changed the title Unable to use Vuforia with the plugin on ios Error when running flutter run while embedding a Unity Project with Vuforia as its AR Framework Feb 7, 2021
@ChrisLmis
Copy link

I am experiencing the exact same error

@mtpython
Copy link

Similar problem, the app builds, and then immediately produces the error.

here's my environment:

  • Unity 2019.4.20f1 LTS (iOS only)
  • Latest flutter-unity-view-widget from github reference
  • Latest Vuforia 9.7.5
  • example app from this repository with a simple Vuforia AR Camera added
  • iPhone X with latest iOS

Flutter doctor:

[✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.1 20D75 darwin-x64, locale en-GB)
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)

(Android skipped, because the issue is only with iOS)

XCode build completes successfully, but there's an error immediately after the app starts:

dyld: Library not loaded: @rpath/Vuforia.framework/Vuforia
 Referenced from: /private/var/containers/Bundle/Application/516A693D-9396-43F6-9347-C9576F2F5303/Runner.app/Frameworks/UnityFramework.framework/UnityFramework
 Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
(lldb)

Steps to reproduce are very simple:

  • Follow https://youtu.be/icxfRM_qEnU , but with a physical device
  • do the get Vuforia steps further
    or
  • clone flutter-unity-view-widget repo
  • go into example folder and get flutter packages
  • open unity DemoApp project with any unity ^version (I use 2019.4.20f1 LTS)
  • get Vuforia:
  • set up correct player settings (see screenshot)
  • Flutter -> Export iOS (see folder structure screenshot)
  • open ios/Runner.xcworkspace
  • switch Target Membership of Unity-iPhone > Data to UnityFramework only (see xcode tree screenshot)

I've also changed the Signing & Capabilities to my licensed team, and switched the Vuforia.framework's target membership with a similar manner, but it remains the same.

It seems to be a simple issue of XCode build note being able to locate Vuforia correctly, but I don't have enough XCode experience to find out how to fix it.

Error on running, after successful build:
vuforia-error

XCode project structure:
vuforia-xcode-tree

example folder structure after Unity Flutter -> Export iOS:
folder-struct

Unity Build & Player settings:
Screenshot 2021-02-23 at 15 16 53

@mtpython
Copy link

mtpython commented Feb 24, 2021

Managed to solve it:

The main step for me was adding both Vuforia and ARFoundationDriver frameworks inside Runner, as it is where Xcode originally looks for them.

Detailed steps for implementing Vuforia iOS in the example:

  • clone flutter-unity-view-widget repo
  • go into example folder, change the plugin dependency to latest git (optional):
flutter_unity_widget:
    git: git://github.com/juicycleff/flutter-unity-view-widget.git
  • get flutter packages
  • open unity/DemoApp project with any Unity 2019.4.3+ version (I use 2019.4.20f1 LTS)
  • get Vuforia:
    • download for Unity here: https://developer.vuforia.com/downloads/sdk - e.g. add-vuforia-package-9-7-5.unitypackage, you can update it further inside Unity
    • follow official Vuforia getting-started till you've added a simple ARCamera to some scene, don't forget to add your license key and save the scene
  • set up correct Build Settings > Player Settings:
    • Resolution and Presentation dropdown > check Render over Native UI*
    • Other Settings dropdown > Bundle identifier: random com.yourname.unityflutter
    • Target minimum iOS Version: 12.0 — see Vuforia iOS version
    • Architecture: ARM64
  • Flutter -> Export iOS, your folder structure should include ios/UnityLibrary afterwards
  • open ios/Runner.xcworkspace
  • switch Target Membership of Unity-iPhone > Data to UnityFramework only
  • in Signing & Capabilities set up your correct Team (mine is paid, and I did set it for both Unity-iPhone and Runner)
  • flutter run to generate Pods
  • back in Xcode: Runner > right click on Frameworks > Add Files to "Runner" — add both:
    • (...)/ios/UnityLibrary/Frameworks/com.ptc.vuforia.engine/Vuforia/Plugins/iOS/Vuforia.framework
    • (...)/ios/UnityLibrary/Frameworks/com.ptc.vuforia.engine/Vuforia/Plugins/iOS/ARFoundationDriver.framework
  • in Runner > General tab > Frameworks, Libraries, and Embedded content dropdown: change both added frameworks to Embed & Sign

Related errors:

  • if you get a blank (black) screen in Vuforia — you're probably using Vuforia version <9.X.Y:
    • in Unity Build Settings > Player Settings > uncheck Auto Graphics API, and set it to OpenGLES3
    • otherwise migrate your Unity project to latest Vuforia version, which supports Metal
  • Vuforia doesn't detect anything, and you get Dataset <name> could not be loaded error — see reply in Dataset Foo could not be loaded and cannot be activated. #115 :
    • drag-n-drop your Unity-iPhone > Vuforia & Data folders into Runner
    • check Target Membership: Runner

It's probably not the best way to solve this problem, we should just be able to modify the search path to where the the frameworks are originally placed, but I've tried in multiple places to no success.

@Badjessa-git, @ChrisLmis, please comment if this helps you, maybe someone more experienced with Xcode could help finding a better way, or we could just add this solution into readme Vuforia: iOS section.

@VivianKuKu
Copy link

VivianKuKu commented Jun 4, 2022

Hi @mtpython,

I have this error, do you happen to know how to fix it?

Error: framework not found Vuforia

ld: warning: directory not found for option '-F/Users/kuchin/2_Connected-Environments/9_CASA0022_Dissertation/6_Flutter-and-Unity/flutter_app_test/ios/Pods/../UnityLibrary'
ld: warning: directory not found for option '-F/Users/kuchin/2_Connected-Environments/9_CASA0022_Dissertation/6_Flutter-and-Unity/flutter_app_test/ios/Pods/../.symlinks/flutter/ios-release'

Screenshot 2022-06-04 at 18 37 57

@Ahmadre
Copy link
Collaborator

Ahmadre commented May 24, 2024

@mtpython
Works perfectly :) thanks!

The current Vuforia Third party frameworks look like this:

Bildschirmfoto 2024-05-24 um 16 59 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants