1717package com.google.firebase.sessions
1818
1919import android.content.Context
20+ import android.util.Log
2021import androidx.annotation.Keep
22+ import androidx.datastore.preferences.preferencesDataStore
2123import com.google.android.datatransport.TransportFactory
2224import com.google.firebase.FirebaseApp
2325import com.google.firebase.annotations.concurrent.Background
@@ -69,6 +71,7 @@ internal class FirebaseSessionsRegistrar : ComponentRegistrar {
6971 )
7072
7173 private companion object {
74+ const val TAG = " FirebaseSessions"
7275 const val LIBRARY_NAME = " fire-sessions"
7376
7477 val appContext = unqualified(Context ::class .java)
@@ -78,5 +81,29 @@ internal class FirebaseSessionsRegistrar : ComponentRegistrar {
7881 val blockingDispatcher = qualified(Blocking ::class .java, CoroutineDispatcher ::class .java)
7982 val transportFactory = unqualified(TransportFactory ::class .java)
8083 val firebaseSessionsComponent = unqualified(FirebaseSessionsComponent ::class .java)
84+
85+ init {
86+ try {
87+ ::preferencesDataStore.javaClass
88+ } catch (ex: NoClassDefFoundError ) {
89+ Log .w(
90+ TAG ,
91+ """
92+ Your app is experiencing a known issue in the Android Gradle plugin, see https://issuetracker.google.com/328687152
93+
94+ It affects Java-only apps using AGP version 8.3.2 and under. To avoid the issue, either:
95+
96+ 1. Upgrade Android Gradle plugin to 8.4.0+
97+ Follow the guide at https://developer.android.com/build/agp-upgrade-assistant
98+
99+ 2. Or, add the Kotlin plugin to your app
100+ Follow the guide at https://developer.android.com/kotlin/add-kotlin
101+
102+ 3. Or, do the technical workaround described in https://issuetracker.google.com/issues/328687152#comment3
103+ """
104+ .trimIndent(),
105+ )
106+ }
107+ }
81108 }
82109}
0 commit comments