17
17
package com.google.firebase.sessions
18
18
19
19
import android.content.Context
20
+ import android.util.Log
20
21
import androidx.annotation.Keep
22
+ import androidx.datastore.preferences.preferencesDataStore
21
23
import com.google.android.datatransport.TransportFactory
22
24
import com.google.firebase.FirebaseApp
23
25
import com.google.firebase.annotations.concurrent.Background
@@ -69,6 +71,7 @@ internal class FirebaseSessionsRegistrar : ComponentRegistrar {
69
71
)
70
72
71
73
private companion object {
74
+ const val TAG = " FirebaseSessions"
72
75
const val LIBRARY_NAME = " fire-sessions"
73
76
74
77
val appContext = unqualified(Context ::class .java)
@@ -78,5 +81,29 @@ internal class FirebaseSessionsRegistrar : ComponentRegistrar {
78
81
val blockingDispatcher = qualified(Blocking ::class .java, CoroutineDispatcher ::class .java)
79
82
val transportFactory = unqualified(TransportFactory ::class .java)
80
83
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
+ }
81
108
}
82
109
}
0 commit comments