Skip to content

Android SDK crashes on Unity player #1711

Closed

Description

@bruno-garcia

While trying to add the Android SDK to the Unity SDK through getsentry/sentry-unity#307:

Building from main branch, with the SDK added but no DSN given, the app fails to launch with:

09-11 17:38:03.873  6108  6108 D Sentry  : io.sentry.auto-init read: true
09-11 17:38:03.873  6108  6108 I Sentry  : Retrieving auto-init from AndroidManifest.xml
09-11 17:38:03.890  1199  6134 E ResolverController: No valid NAT64 prefix (100, <unspecified>/0)
09-11 17:38:03.899  6108  6108 D AndroidRuntime: Shutting down VM
09-11 17:38:03.900  6108  6108 E AndroidRuntime: FATAL EXCEPTION: main
09-11 17:38:03.900  6108  6108 E AndroidRuntime: Process: com.DefaultCompany.unityofbugs, PID: 6108
09-11 17:38:03.900  6108  6108 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/app/FrameMetricsAggregator;
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.ActivityFramesTracker.<init>(ActivityFramesTracker.java:20)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.AndroidOptionsInitializer.init(AndroidOptionsInitializer.java:103)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.AndroidOptionsInitializer.init(AndroidOptionsInitializer.java:69)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.AndroidOptionsInitializer.init(AndroidOptionsInitializer.java:53)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.SentryAndroid.lambda$init$1(SentryAndroid.java:74)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.-$$Lambda$SentryAndroid$g99QaqNwcEFxja-3CMUNWZ36_g4.configure(Unknown Source:8)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.Sentry.init(Sentry.java:116)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:71)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:40)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.SentryInitProvider.onCreate(SentryInitProvider.java:27)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.content.ContentProvider.attachInfo(ContentProvider.java:2092)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.content.ContentProvider.attachInfo(ContentProvider.java:2066)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at io.sentry.android.core.SentryInitProvider.attachInfo(SentryInitProvider.java:44)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:7237)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:6782)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6693)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.app.ActivityThread.access$1400(ActivityThread.java:232)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2014)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:107)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:241)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7617)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
09-11 17:38:03.900  6108  6108 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: androidx.core.app.FrameMetricsAggregator

Activity

  1. marandaneto commented on Sep 13, 2021

    @marandaneto
    Contributor

    @bruno-garcia as you do with gson, you've to do with the other transitive dependencies since the msbuild does not use Gradle to resolve dependencies via Maven.

    // lifecycle processor, session tracking
    implementation(Config.Libs.lifecycleProcess)
    implementation(Config.Libs.lifecycleCommonJava8)
    implementation(Config.Libs.androidxCore)
    

    also its dependencies, the other way around is disabling/removing the integrations/processors that use them.
    AppLifecycleIntegration, ActivityLifecycleIntegration and PerformanceAndroidEventProcessor

    does that help? can we close it?

  2. bruno-garcia commented on Sep 14, 2021

    @bruno-garcia
    MemberAuthor

    @marandaneto So those are now mandatory dependencies?
    I'm not sure we want to impose those upon Unity games

    also its dependencies, the other way around is disabling/removing the integrations/processors that use them.
    AppLifecycleIntegration, ActivityLifecycleIntegration and PerformanceAndroidEventProcessor

    I see, we'd need a way to turn them off via AndroidManifest, this way we can just opt-out and avoid the extra dependencies.

    Alternatively if we end up using some of the performance features from the Android SDK we can just force the dependencies into the app.

  3. marandaneto commented on Sep 14, 2021

    @marandaneto
    Contributor

    they always were -> https://docs.sentry.io/platforms/android/configuration/releases/#androidx-support since those features are enabled by default.
    either we disable performance and release health or do reflection to check its availability, actually we do that for release health, its probably not checking for androidxCore

  4. bruno-garcia commented on Sep 14, 2021

    @bruno-garcia
    MemberAuthor

    @marandaneto we're probably better off introducing a toggle we can add to the manifest that turns off that stuff. We'd like to unblock this: getsentry/sentry-unity#307

  5. marandaneto commented on Sep 14, 2021

    @marandaneto
    Contributor

    @bruno-garcia the toggle is disabling the features I've mentioned, they already have manifest options.
    what do you mean by turns off that stuff?

  6. ghost added
    Bug
    on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions