sentry-unity icon indicating copy to clipboard operation
sentry-unity copied to clipboard

Android|iOS Native + Unity

Open VadymTykhoniuk opened this issue 3 years ago • 12 comments
trafficstars

I wondering if I can use both Unity and Android SDK together. I need to stream data from Unity App to unity dashboard and Android|iOS native app to their dashboards accordingly. I have native app which implements unity player as a view so that's the reason why I want this. If no, then I should probably use some tag to separate logs in groups?

VadymTykhoniuk avatar Oct 07 '22 08:10 VadymTykhoniuk

Disabling the native support from within Unity and adding the Android SDK to your underlying app does not work for you? It is not a use case we currently support but I would expect it to work. Bare in mind that those two layers won't communicate.

bitsandfoxes avatar Oct 07 '22 08:10 bitsandfoxes

Didn't try it yet, will check. But I believe it won't resolve manifest collision on android, where sentry dsn path is stored?

VadymTykhoniuk avatar Oct 07 '22 08:10 VadymTykhoniuk

Nope, issue is still exists. On iOS I get this issue Library not loaded: @rpath/Sentry.framework/Sentry Reason: tried: '/private/var/containers/Bundle/Application/27C7ADCD-873D-447B-9950-8958B5DBA689/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/27C7ADCD-873D-447B-9950-8958B5DBA689/Surprise-Stage.app/Frameworks/UnityFramework.framework/Frameworks/Sentry.framework/Sentry' (errno=2), '/usr/lib/swift/Sentry.framework/Sentry' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/27C7ADCD-873D-447B-9950-8958B5DBA689/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/27C7ADCD-873D-447B-9950-8958B5DBA689/Surprise-Stage.app/Frameworks/Sentry.

VadymTykhoniuk avatar Oct 07 '22 11:10 VadymTykhoniuk

On Android I basically same issue about library duplication.

VadymTykhoniuk avatar Oct 07 '22 11:10 VadymTykhoniuk

Did you disable native support from the Unity SDK?

bitsandfoxes avatar Oct 07 '22 12:10 bitsandfoxes

Yes

VadymTykhoniuk avatar Oct 07 '22 12:10 VadymTykhoniuk

Library not loaded: @rpath/Sentry.framework/Sentry Reason: tried: '/private/var/containers/Bundle/Application/27C7ADCD-873D-447B-9950-8958B5DBA689/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2)

The native SDKs get set up during the build process. That log mentions Framework/Sentry.framework which indicates to me that the SDK tried to set up the Cocoa SDK (and hence the conflict). Could you try running a clean build (i.e. completely delete the output directory)?

With the native support disabled there should be no modifications to the generated Gradle/Xcode projects.

Are you perhaps able to provide a minimal repro?

bitsandfoxes avatar Oct 07 '22 13:10 bitsandfoxes

Oh, yes, I probably forgot to make clean build

VadymTykhoniuk avatar Oct 07 '22 13:10 VadymTykhoniuk

@bitsandfoxes Hi, issue is still persist, I would say it looks same as in https://github.com/getsentry/sentry-unity/issues/969

VadymTykhoniuk avatar Oct 13 '22 09:10 VadymTykhoniuk

dyld[9701]: Library not loaded: @rpath/Sentry.framework/Sentry Referenced from: <ED77ABE7-EE6A-38F9-915A-A083A757554E> /private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/UnityFramework.framework/UnityFramework Reason: tried: '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/UnityFramework.framework/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/preboot/Cryptexes/OS@rpath/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/UnityFramework.framework/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/System/Library/Frameworks/Sentry.framework/Sentry' (errno=2, not in dyld cache) Library not loaded: @rpath/Sentry.framework/Sentry Referenced from: <ED77ABE7-EE6A-38F9-915A-A083A757554E> /private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/UnityFramework.framework/UnityFramework Reason: tried: '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/UnityFramework.framework/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A3897-FE9A-405F-A7BA-DF27690D93D5/Surprise-Stage.app/Frameworks/Sentry.framework/Sentry' (errno=2), '/private/preboot/Cryptexes/OS@rpath/Sentry.framework/Sentry' (errno=2), '/private/var/containers/Bundle/Application/062A38 dyld config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/usr/lib/libBacktraceRecording.dylib:/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/System/Library/PrivateFrameworks/GPUToolsCapture.framework/GPUToolsCapture (lldb)

VadymTykhoniuk avatar Oct 13 '22 09:10 VadymTykhoniuk

I just created empty project and it works without Native Support.

Must be problem happen when I'm converting UnityXcode project to an xcframework in order to use unity as library. Probably issue could be related to modulemap or smth https://github.com/Unity-Technologies/uaal-example/blob/master/docs/ios.md

VadymTykhoniuk avatar Oct 13 '22 09:10 VadymTykhoniuk

Thanks for pointing this out. So there definitely is a conflict when enabling native support and embedding the Unity game as a library/framework inside of another project. I'm not really sure we can/want to resolve this. Our SDKs are not intended to be used in libraries and bringing it twice is kind of expected to create friction.

bitsandfoxes avatar Oct 13 '22 11:10 bitsandfoxes

I disable native support and embed unity game as library inside of another project. And that another project has sentry installed via cocoa

VadymTykhoniuk avatar Oct 18 '22 08:10 VadymTykhoniuk

The 1.2.0 release is going to address this. With native support disabled the SDK will no longer modify the exported project.

bitsandfoxes avatar Apr 04 '23 17:04 bitsandfoxes