Skip to content

Commit f232c9d

Browse files
committed
Add warning for known issue b/328687152
1 parent 9340503 commit f232c9d

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

firebase-sessions/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22

3+
* [changed] Add warning for known issue b/328687152
34
* [changed] Use Dagger for dependency injection
45
* [changed] Updated datastore dependency to `1.1.3` to
56
fix [CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8).

firebase-sessions/src/main/kotlin/com/google/firebase/sessions/FirebaseSessionsRegistrar.kt

+27
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
package com.google.firebase.sessions
1818

1919
import android.content.Context
20+
import android.util.Log
2021
import androidx.annotation.Keep
22+
import androidx.datastore.preferences.preferencesDataStore
2123
import com.google.android.datatransport.TransportFactory
2224
import com.google.firebase.FirebaseApp
2325
import 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

Comments
 (0)