firebase-android-sdk
firebase-android-sdk copied to clipboard
firebase-sessions 1.2.4 is not compatible with datastore-preferences 1.1.0
[REQUIRED] Step 2: Describe your environment
- Android Studio version: 2023.2.1 Patch 2
- Firebase Component: don't know exacly ... i'm using crashlytics and messaging
- Component version: see bellow
[REQUIRED] Step 3: Describe the problem
with component version as
firebase-core = "21.1.1"
firebase-crashlytics = "18.6.4"
firebase-messaging = "23.4.1"
and
datastore-preferences = "1.1.0"
Application crash at the start with
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/datastore/preferences/PreferenceDataStoreDelegateKt;
at com.google.firebase.sessions.settings.SessionsSettings.<clinit>(SessionsSettings.kt:149)
at com.google.firebase.sessions.FirebaseSessionsRegistrar.getComponents$lambda-3(FirebaseSessionsRegistrar.kt:87)
at com.google.firebase.sessions.FirebaseSessionsRegistrar.$r8$lambda$FCiG63jqx5Mf3dod-mkZXs23qnc(Unknown Source:0)
at com.google.firebase.sessions.FirebaseSessionsRegistrar$$ExternalSyntheticLambda3.create(D8$$SyntheticClass:0)
at com.google.firebase.tracing.ComponentMonitor.lambda$processRegistrar$0(ComponentMonitor.java:38)
at com.google.firebase.tracing.ComponentMonitor$$ExternalSyntheticLambda0.create(D8$$SyntheticClass:0)
at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$com-google-firebase-components-ComponentRuntime(ComponentRuntime.java:160)
at com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda2.get(D8$$SyntheticClass:0)
at com.google.firebase.components.Lazy.get(Lazy.java:53)
at com.google.firebase.components.ComponentContainer.get(ComponentContainer.java:48)
at com.google.firebase.components.RestrictedComponentContainer.get(RestrictedComponentContainer.java:105)
at com.google.firebase.sessions.FirebaseSessionsRegistrar.getComponents$lambda-0(FirebaseSessionsRegistrar.kt:52)
at com.google.firebase.sessions.FirebaseSessionsRegistrar.$r8$lambda$me3-yZC2pOH9X-lURhz9tK7161I(Unknown Source:0)
at com.google.firebase.sessions.FirebaseSessionsRegistrar$$ExternalSyntheticLambda0.create(D8$$SyntheticClass:0)
at com.google.firebase.tracing.ComponentMonitor.lambda$processRegistrar$0(ComponentMonitor.java:38)
at com.google.firebase.tracing.ComponentMonitor$$ExternalSyntheticLambda0.create(D8$$SyntheticClass:0)
at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$com-google-firebase-components-ComponentRuntime(ComponentRuntime.java:160)
at com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda2.get(D8$$SyntheticClass:0)
at com.google.firebase.components.Lazy.get(Lazy.java:53)
at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents(ComponentRuntime.java:322)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(ComponentRuntime.java:312)
at com.google.firebase.FirebaseApp.initializeAllApis(FirebaseApp.java:607)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:300)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:264)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:249)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:69)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2404)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2374)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:61)
at android.app.ActivityThread.installProvider(ActivityThread.java:7422)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6939)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6710)
at android.app.ActivityThread.access$1500(ActivityThread.java:247)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
while with datastore-preferences = "1.0.0"
all working fine (besides fact that I cannot use 1.0.0 with java code which I preffer)
Steps to reproduce:
I'm 99% sure that when you would take any project using any firebase's component which depends on com.google.firebase.sessions.settings.SessionsSettings
it would behave in the same way
Relevant Code:
I belive that code is irrelevant ... it is just incompatibility between datastore-preferences 1.0.0 and datastore-preferences 1.1.0
I found a few problems with this issue:
- I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
- This issue does not seem to follow the issue template. Make sure you provide all the required information.
Hi @SelvinPL, thank you for reaching out. I tried reproducing the issue by overriding the current datastore-preference 1.0.0 dependency to datastore-preference 1.0.0, however, I wasn't able to encounter the error.
To clarify, the Firebase Session is used by Crashlytics and Performance internally to measure sessions. Were you able to reproduce the issue? Could you share an MCVE to help us investigate the issue?
seems like it is crashlytics minimal example:
topmost build.gradle
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.google.gms:google-services:4.4.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
main build.gradle
apply plugin: 'com.android.application'
android {
buildToolsVersion = '34.0.0'
namespace "com.example"
defaultConfig {
compileSdk 34
applicationId "com.example"
minSdkVersion 22
targetSdkVersion 34
versionCode 1000003
versionName "1.0.3"
}
signingConfigs {
release {
storeFile file(...)
storePassword ...
keyAlias ...
keyPassword ...
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug{
debuggable true
signingConfig signingConfigs.release
}
}
}
dependencies {
implementation "androidx.datastore:datastore-preferences:1.1.0"
implementation "com.google.firebase:firebase-crashlytics:18.6.4"
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" >
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
package com.example;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new Button(this));
}
}
gradle.properties
org.gradle.jvmargs=-Xmx3g
org.gradle.caching=true
android.useAndroidX=true
My app is crashing with the very same exact crash log as commented by the OP, all I just done was to upgrade implementation 'androidx.datastore:datastore-preferences-rxjava3:1.0.0'
to implementation 'androidx.datastore:datastore-preferences-rxjava3:1.1.0'
the crash is not random, but consistent on all tested devices.
Hi folks! I still wasn't able to reproduce the issue when using the androidx.datastore:datastore-preferences-rxjava3:1.1.0
or androidx.datastore:datastore-preferences:1.1.0
. I have create an MCVE to replicate the issue, am I missing anything?
I'm using java not kotlin. And example was in java. Maybe this is culprit
Here is your Minimal Reproducible example: https://drive.google.com/file/d/1PwhccRY2e0dfMbHjrovSmPZhsnRNGrBK/view?usp=sharing
There was a prior discussion around this issue, I'm linking it here for visibility: #5176 (the fix that was implemented back then was reverted at some point because it caused a different issue)
seems to be working fine with 8.4.0 build tools ... closing
Yes, thanks.