getsentry / sentry-unity

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

Clean `Library` cache when updating the SDK #1847

Open bitsandfoxes opened 2 hours ago

bitsandfoxes commented 2 hours ago

We keep running into issue when users update the SDK with the build cache not invalidating the build cache. This most often causes issues with the Android native SDK not getting updated properly causing errors like

2024/10/14 14:35:11.465 11495 11708 Error Unity Sentry: Error during JNI execution: UnityEngine.AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='setUser' signature='()V' in class Ljava.lang.Object;
2024/10/14 14:35:11.465 11495 11708 Error Unity   at UnityEngine._AndroidJNIHelper.GetMethodID (System.IntPtr jclass, System.String methodName, System.String signature, System.Boolean isStatic) [0x00000] in <00000000000000000000000000000000>:0 
2024/10/14 14:35:11.465 11495 11708 Error Unity   at UnityEngine.AndroidJavaObject._CallStatic (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0 
2024/10/14 14:35:11.465 11495 11708 Error Unity   at Sentry.Unity.Android.AndroidJavaScopeObserver.<UnsetUserImpl>b__8_0 () [0x00000] in <00000000000000000000000000000000>:0 
2024/10/14 14:35:11.465 11495 11708 Error Unity   at Sentry.Unity.Android.JniExecutor.DoWork () [0x00000] in <00000000000000000000000000000000>:0 
2024/10/14 14:35:11.465 11495 11708 Error Unity   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
2024/10/14 14:35:11.465 11495 11708 Error Unity  #0 0x77c1a3b10c (libu

The current workaround is to delete the Library folder and recreating it.

bitsandfoxes commented 2 hours ago

We have a draft here that provides some editor utility to notify regarding package updates.