getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
207 stars 51 forks source link

App freezes at startup with Sentry disabled #1713

Closed aleh-patseyeu closed 2 months ago

aleh-patseyeu commented 3 months ago

Environment

Android

How do you use Sentry? Sentry SaaS (sentry.io)

Which version of the SDK? 2.1.0

How did you install the package? (Git-URL, Assetstore) Git-URL

Which version of Unity? 2022.3.28f

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? Android

Steps to Reproduce

  1. Select Android as a build platform
  2. Set scripting backend to IL2CPP
  3. Disable Sentry in SDK Options

Expected Result

Apps starts normally. Sentry is disabled.

Actual Result

App freezes at startup.

What actually happened. Maybe a screenshot/recording? Maybe some logs? Seems like some Sentry code is being stripped during build process. Adding io.sentry.unity.runtime assembly to link.xml or configuring progruad rules doesn't help.

2024/07/04 17:47:09.748 17067 17124 Error Unity Sentry: Error during JNI execution: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: io.sentry.Sentry
2024/07/04 17:47:09.748 17067 17124 Error Unity   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 
2024/07/04 17:47:09.748 17067 17124 Error Unity   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0 
2024/07/04 17:47:09.748 17067 17124 Error Unity   at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <00000000000000000000000000000000>:0 
2024/07/04 17:47:09.748 17067 17124 Error Unity   at Sentry.Unity.Android.SentryJava.GetSentryJava () [0x00000] in <00000000000000000000000000000000>:0 
2024/07/04 17:47:09.748 17067 17124 Error Unity   at Sentry.Unity.Android.SentryJava+<>c.<Close>b__2_0 () [0x00000] in <00000000000000000000000000000000>:0 
2024/07/04 17:47:09.748 17067 17124 Error Unity   at Sentry.Unity.Android.JniExecutor.DoWork () [0x00000] in <00000000000000000000000000000000>:0 
2024/07/04 17:47:09.748 17067 17124 Error Unity   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <0000000000000000000000000000000

Any logs or screenshots

bitsandfoxes commented 3 months ago

Hey @aleh-patseyeu, sorry to see you run into trouble.

Disable Sentry in SDK Options

How are you disabling the SDK? In the Editor window?

aleh-patseyeu commented 3 months ago

@bitsandfoxes Yes, in the Editor window

bitsandfoxes commented 3 months ago

Do you have a runtime config scriptable object that enables native support at runtime?

aleh-patseyeu commented 2 months ago

Do you have a runtime config scriptable object that enables native support at runtime?

Nope, native support state is not modified at runtime in this case.

GabrielJadderson commented 2 months ago

We are also experiencing this exact issue.

bitsandfoxes commented 2 months ago

Thanks for reaching out! A fix is on its way.