sentry-unity: Intermittent splash screen hang on Android

Environment

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

Which SDK and version? Sentry Unity 0.4.3 (https://github.com/getsentry/unity.git#0.4.3 via UPM)

Steps to Reproduce

  1. Add Sentry to the project and enter the DSN
  2. Build an Android APK
  3. Run the Android app

Result

When running the built Android app, sometimes it will work, but roughly 1 in 10 starts of the app will hang indefinitely on the splash screen. This was a baffling issue, and it is resolved by removing sentry-unity from the project.

Looking at adb logcat for one of the hangs, it seems to print this:

08-20 17:17:07.104 27021 27036 I zygote  : Rejecting re-init on previously-failed class java.lang.Class<com.unity3d.player.AssetPackManagerWrapper$b>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/play/core/assetpacks/AssetPackStateUpdateListener;
08-20 17:17:07.104 27021 27036 I zygote  :   at boolean com.unity3d.player.UnityPlayer.nativeRender() ((null):-2)
08-20 17:17:07.104 27021 27036 I zygote  :   at boolean com.unity3d.player.UnityPlayer.access$300(com.unity3d.player.UnityPlayer) ((null):-1)
08-20 17:17:07.104 27021 27036 I zygote  :   at boolean com.unity3d.player.UnityPlayer$e$1.handleMessage(android.os.Message) ((null):-1)
08-20 17:17:07.104 27021 27036 I zygote  :   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
08-20 17:17:07.104 27021 27036 I zygote  :   at void android.os.Looper.loop() (Looper.java:164)
08-20 17:17:07.104 27021 27036 I zygote  :   at void com.unity3d.player.UnityPlayer$e.run() ((null):-1)
08-20 17:17:07.104 27021 27036 I zygote  : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.play.core.assetpacks.AssetPackStateUpdateListener" on path: DexPathList[[zip file "/data/app/me.overflo.mygame-Jtekv7VX5bBOly1L6sqzfA==/base.apk"],nativeLibraryDirectories=[/data/app/me.overflo.mygame-Jtekv7VX5bBOly1L6sqzfA==/lib/arm, /data/app/me.overflo.mygame-Jtekv7VX5bBOly1L6sqzfA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
08-20 17:17:07.104 27021 27036 I zygote  :   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
08-20 17:17:07.104 27021 27036 I zygote  :   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
08-20 17:17:07.104 27021 27036 I zygote  :   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
08-20 17:17:07.104 27021 27036 I zygote  :   at boolean com.unity3d.player.UnityPlayer.nativeRender() ((null):-2)
08-20 17:17:07.104 27021 27036 I zygote  :   at boolean com.unity3d.player.UnityPlayer.access$300(com.unity3d.player.UnityPlayer) ((null):-1)
08-20 17:17:07.104 27021 27036 I zygote  :   at boolean com.unity3d.player.UnityPlayer$e$1.handleMessage(android.os.Message) ((null):-1)
08-20 17:17:07.104 27021 27036 I zygote  :   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
08-20 17:17:07.104 27021 27036 I zygote  :   at void android.os.Looper.loop() (Looper.java:164)
08-20 17:17:07.104 27021 27036 I zygote  :   at void com.unity3d.player.UnityPlayer$e.run() ((null):-1)

I wasn’t able to make much sense of that, but it does seem to only be printed on the launches that hang. No logs are printed from my C# code on these launches, implying that it hasn’t started to properly load the game yet.

The issue is not reproducible on iOS or PC. There isn’t a consistent gap between launches that hang - sometimes they’re only 1 or 2 apart, sometimes you can go for 10 or more without seeing anything go wrong. I had to sit and open and close the app over and over haha

Potentially useful info

Unity version - 2021.1.17f1 Scripting Backend - IL2CPP API Compatibility Level - .NET Standard 2.0 C++ Compiler Configuration - Master

Please do let me know if there’s any other info that would be helpful for debugging this issue - I’d love to be able to use Sentry in my project. I might come back and attach a reproducible example project if I have the time this weekend.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Thank you so much for the video and the repro. We’ll definitely take a look at this really soon and get back to you.

Hey, I was able to reproduce the issue very easily - just a blank new project with Sentry added does the trick. I was able to make repros for

Unity 2020.3.12f1: https://drive.google.com/file/d/1BhU0RFRtCsRN0wLl-6-xDep5Xq22g4C4/view?usp=sharing And Unity 2021.1.17f1 https://drive.google.com/file/d/1ky3v17HH_t4l4gEA4kyTAoYnZ_PBRXyd/view?usp=sharing

These are just the Unity versions I had lying around installed on my machine. I use 2021.1.17 for my game (the main project I filed this issue for).

To make the repros smaller to download, I removed the Library, Temp and Logs folders from the projects, but let me know if you need them - I can upload them. I also removed my Sentry DSN, leaving that field blank.

Just in case you’re unable to reproduce, I’ve uploaded a video of what the issue looks like, and the amount of attempts it sometimes takes (happens at 2 minutes 20 seconds).

Hope these help! And thanks for your help so far