Skip to content

[Bug] AndroidX DataStore library missing - Instant Crash - App will not open #1225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dcosmin-97 opened this issue Mar 31, 2025 · 6 comments

Comments

@dcosmin-97
Copy link

Description

You need the following:
Unity 6000.0.44f1
Admob 10.0
Mediations: Liftoff, Meta, Unity, Pangle, Inmobi, Applovin - latest versions available.
EDM: 1.2.185

Device:

  • Android 14
  • Samsung S22

Firebase 12.8 with the following packages:

  • Analytics
  • AppCheck
  • Auth
  • Crashlytics
  • Firestore
  • Functions
  • Messaging

The app will instantly crash.
Errors:
Fatal Exception: java.lang.NoClassDefFoundError
Failed resolution of: Landroidx/datastore/preferences/PreferenceDataStoreDelegateKt;
Caused by java.lang.ClassNotFoundException
androidx.datastore.preferences.PreferenceDataStoreDelegateKt

Current fix:

  • Rollback to 12.6

Reproducing the issue

Unity 6000.0.44f1
Admob 10.0
Mediations: Liftoff, Meta, Unity, Pangle, Inmobi, Applovin - latest versions available.
EDM: 1.2.185

Device:

  • Android 14
  • Samsung S22

Firebase 12.8 with the following packages:

  • Analytics
  • AppCheck
  • Auth
  • Crashlytics
  • Firestore
  • Functions
  • Messaging

Firebase Unity SDK Version

12.8

Unity editor version

6000.0.44f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

All

Other Firebase Component(s) in use

Analytics, App Check, Authentication, Crashlytics, Firestore, Functions, Messaging

Additional SDKs you are using

Meta
Liftoff
Admob
Unity
Pangle
Applovin

-> All of them are latest versions

Targeted Platform(s)

Android

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

Fatal Exception: java.lang.NoClassDefFoundError
Failed resolution of: Landroidx/datastore/preferences/PreferenceDataStoreDelegateKt;
com.google.firebase.sessions.settings.SessionsSettings.<clinit> (SessionsSettings.kt:156)
com.google.firebase.sessions.settings.SessionsSettings_Factory.newInstance (SessionsSettings_Factory.java:57)
com.google.firebase.sessions.settings.SessionsSettings_Factory.get (SessionsSettings_Factory.java:44)
com.google.firebase.sessions.settings.SessionsSettings_Factory.get (SessionsSettings_Factory.java:13)
com.google.firebase.sessions.dagger.internal.DoubleCheck.get (DoubleCheck.java:47)
com.google.firebase.sessions.FirebaseSessions_Factory.get (FirebaseSessions_Factory.java:41)
com.google.firebase.sessions.FirebaseSessions_Factory.get (FirebaseSessions_Factory.java:13)
com.google.firebase.sessions.dagger.internal.DoubleCheck.get (DoubleCheck.java:47)
com.google.firebase.sessions.DaggerFirebaseSessionsComponent$FirebaseSessionsComponentImpl.getFirebaseSessions (DaggerFirebaseSessionsComponent.java:152)
com.google.firebase.sessions.FirebaseSessionsRegistrar.getComponents$lambda$0 (FirebaseSessionsRegistrar.kt:48)
com.google.firebase.sessions.FirebaseSessionsRegistrar.$r8$lambda$r7-PKYXSbWzr9mCtWMP1_jMCi4s
com.google.firebase.sessions.FirebaseSessionsRegistrar$$ExternalSyntheticLambda0.create (D8$$SyntheticClass)
com.google.firebase.tracing.ComponentMonitor.lambda$processRegistrar$0 (ComponentMonitor.java:38)
com.google.firebase.tracing.ComponentMonitor$$ExternalSyntheticLambda0.create (D8$$SyntheticClass)
com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$com-google-firebase-components-ComponentRuntime (ComponentRuntime.java:160)
com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda2.get (D8$$SyntheticClass)
com.google.firebase.components.Lazy.get (Lazy.java:53)
com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents (ComponentRuntime.java:322)
com.google.firebase.components.ComponentRuntime.initializeEagerComponents (ComponentRuntime.java:312)
com.google.firebase.FirebaseApp.initializeAllApis (FirebaseApp.java:607)
com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:300)
com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:264)
com.google.firebase.FirebaseApp.initializeApp (FirebaseApp.java:249)
com.google.firebase.provider.FirebaseInitProvider.onCreate (FirebaseInitProvider.java:69)
android.content.ContentProvider.attachInfo (ContentProvider.java:2700)
android.content.ContentProvider.attachInfo (ContentProvider.java:2670)
com.google.firebase.provider.FirebaseInitProvider.attachInfo (FirebaseInitProvider.java:61)
android.app.ActivityThread.installProvider (ActivityThread.java:8628)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)

If using CocoaPods for Apple platforms, the project's Podfile.lock

Expand Podfile.lock snippet
👀 Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@dcosmin-97
Copy link
Author

The fix was to go back to Firebase 12.6

@fmoyano
Copy link

fmoyano commented Apr 2, 2025

Same here. I'm getting the same crash on Unity 6 (60000.0.33f1) with Firebase Unity 12.8.0.

@argzdev
Copy link

argzdev commented Apr 2, 2025

Hey folks, I was able to reproduce the behavior. I'll bring this up to our engineers and see what we can do here. Thanks!

@a-maurice
Copy link
Collaborator

a-maurice commented Apr 2, 2025

Thanks for flagging this. Looking at the logs, it prints out this message:

Your app is experiencing a known issue in the Android Gradle plugin, see https://issuetracker.google.com/328687152

It affects Java-only apps using AGP version 8.3.2 and under. To avoid the issue, either:

1. Upgrade Android Gradle plugin to 8.4.0+
   Follow the guide at https://developer.android.com/build/agp-upgrade-assistant

2. Or, add the Kotlin plugin to your app
   Follow the guide at https://developer.android.com/kotlin/add-kotlin

3. Or, do the technical workaround described in https://issuetracker.google.com/issues/328687152#comment3

The problem is Unity versions tend to be under AGP 8.4.0, and so are hit by this issue. We'll see what we can do to automate a fix, but in the meantime you can either use an older version of the Unity SDK, or something that worked for me was in the Unity project, enable the baseProjectTemplate.gradle file, and add this to the top:

buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
    }
}

@dcosmin-97
Copy link
Author

dcosmin-97 commented Apr 5, 2025

Thanks for flagging this. Looking at the logs, it prints out this message:

Your app is experiencing a known issue in the Android Gradle plugin, see https://issuetracker.google.com/328687152

It affects Java-only apps using AGP version 8.3.2 and under. To avoid the issue, either:

1. Upgrade Android Gradle plugin to 8.4.0+
   Follow the guide at https://developer.android.com/build/agp-upgrade-assistant

2. Or, add the Kotlin plugin to your app
   Follow the guide at https://developer.android.com/kotlin/add-kotlin

3. Or, do the technical workaround described in https://issuetracker.google.com/issues/328687152#comment3

The problem is Unity versions tend to be under AGP 8.4.0, and so are hit by this issue. We'll see what we can do to automate a fix, but in the meantime you can either use an older version of the Unity SDK, or something that worked for me was in the Unity project, enable the baseProjectTemplate.gradle file, and add this to the top:

buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
    }
}

So, Unity 6000.0.45f1+ will fix the issue without any other changes https://docs.unity3d.com/Manual/android-gradle-overview.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants