androidfirebasecrashlytics

FirebaseCrashlytics - No userId set for session


I was setting up Firebase Crashlytics by following the Firebase Crashlytics document But when I test crash, there is no crash report show up on my Firebase Crashlytics console. It shows the setup page as shown below :

enter image description here

I am also using Firebase Remote Config and everything works as expected. This may prove that my application can connect to Firebase. I tried to download google-services.json and replace the existing (even it is the same) and it does not work.

= = = = =

I used the following command to debug Crashlytics log.

adb shell setprop log.tag.FirebaseCrashlytics DEBUG
adb logcat -s FirebaseCrashlytics 

And the result is :

05-13 09:22:48.420 28186 28186 I FirebaseCrashlytics: Initializing Firebase Crashlytics 19.0.0 for com.xxx.xxx
05-13 09:22:49.125 28186 28217 I FirebaseCrashlytics: No version control information found
05-13 09:36:10.384 28460 28460 I FirebaseCrashlytics: Initializing Firebase Crashlytics 19.0.0 for com.xxx.xxx
05-13 09:36:10.395 28460 28460 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:10.399 28460 28460 D FirebaseCrashlytics: AnalyticsConnector now available.
05-13 09:36:10.440 28460 28460 D FirebaseCrashlytics: Registered Firebase Analytics listener.
05-13 09:36:10.445 28460 28460 D FirebaseCrashlytics: Could not find resources: 0 0 0
05-13 09:36:10.446 28460 28460 D FirebaseCrashlytics: Mapping file ID is: cccccccccccccccccccccccccccccccc
05-13 09:36:10.567 28460 28460 D FirebaseCrashlytics: Checking for cached settings...
05-13 09:36:10.568 28460 28460 D FirebaseCrashlytics: No cached settings data found.
05-13 09:36:10.571 28460 28460 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:10.601 28460 28460 D FirebaseCrashlytics: Registering RemoteConfig Rollouts subscriber
05-13 09:36:10.630 28460 28484 D FirebaseCrashlytics: Updated Crashlytics Rollout State
05-13 09:36:10.701 28460 28460 D FirebaseCrashlytics: Successfully configured exception handler.
05-13 09:36:10.702 28460 28482 D FirebaseCrashlytics: Opening a new session with ID yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
05-13 09:36:10.715 28460 28482 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:10.747 28460 28482 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:10.747 28460 28482 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:10.751 28460 28482 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:10.787 28460 28482 D FirebaseCrashlytics: Registered Firebase Analytics event receiver for breadcrumbs
05-13 09:36:10.799 28460 28482 I FirebaseCrashlytics: No version control information found
05-13 09:36:10.836 28460 28482 D FirebaseCrashlytics: No userId set for session xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
05-13 09:36:10.836 28460 28482 W FirebaseCrashlytics: Unable to read App Quality Sessions session id.
05-13 09:36:10.836 28460 28504 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:10.840 28460 28482 D FirebaseCrashlytics: appQualitySessionId: null
05-13 09:36:10.859 28460 28482 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:10.859 28460 28482 D FirebaseCrashlytics: Automatic data collection is disabled.
05-13 09:36:10.859 28460 28482 D FirebaseCrashlytics: Waiting for send/deleteUnsentReports to be called.
05-13 09:36:38.797 28460 28460 D FirebaseCrashlytics: Handling uncaught exception "java.lang.RuntimeException: Test Crash" from thread main
05-13 09:36:38.846 28460 28482 D FirebaseCrashlytics: No userId set for session yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
05-13 09:36:38.846 28460 28482 W FirebaseCrashlytics: Unable to read App Quality Sessions session id.
05-13 09:36:38.846 28460 28482 D FirebaseCrashlytics: appQualitySessionId: null
05-13 09:36:38.871 28460 28482 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:38.871 28460 28482 D FirebaseCrashlytics: Opening a new session with ID aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
05-13 09:36:38.871 28460 28482 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:38.897 28460 28482 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:36:38.909 28460 28460 D FirebaseCrashlytics: Completed exception processing. Invoking default exception handler.
05-13 09:37:58.773 28579 28579 I FirebaseCrashlytics: Initializing Firebase Crashlytics 19.0.0 for com.xxx.xxx
05-13 09:37:58.811 28579 28579 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:37:58.815 28579 28579 D FirebaseCrashlytics: AnalyticsConnector now available.
05-13 09:37:58.822 28579 28579 D FirebaseCrashlytics: Registered Firebase Analytics listener.
05-13 09:37:58.833 28579 28579 D FirebaseCrashlytics: Could not find resources: 0 0 0
05-13 09:37:58.833 28579 28579 D FirebaseCrashlytics: Mapping file ID is: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
05-13 09:37:58.842 28579 28579 D FirebaseCrashlytics: Checking for cached settings...
05-13 09:37:58.842 28579 28579 D FirebaseCrashlytics: No cached settings data found.
05-13 09:37:58.843 28579 28579 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:37:58.909 28579 28579 D FirebaseCrashlytics: Registering RemoteConfig Rollouts subscriber
05-13 09:37:58.918 28579 28611 D FirebaseCrashlytics: Updated Crashlytics Rollout State
05-13 09:37:58.931 28579 28579 D FirebaseCrashlytics: Successfully configured exception handler.
05-13 09:37:58.940 28579 28604 D FirebaseCrashlytics: Opening a new session with ID zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
05-13 09:37:58.940 28579 28604 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:37:58.943 28579 28604 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:37:58.948 28579 28604 D FirebaseCrashlytics: Registered Firebase Analytics event receiver for breadcrumbs
05-13 09:37:58.949 28579 28604 I FirebaseCrashlytics: No version control information found
05-13 09:37:58.950 28579 28604 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.
05-13 09:37:58.950 28579 28604 D FirebaseCrashlytics: Automatic data collection is disabled.
05-13 09:37:58.950 28579 28604 D FirebaseCrashlytics: Waiting for send/deleteUnsentReports to be called.
05-13 09:37:58.976 28579 28626 D FirebaseCrashlytics: Crashlytics automatic data collection DISABLED by firebase_crashlytics_collection_enabled manifest flag.

Where 09:36:38 is when I crash the app and 09:37:58 is when I restart the app.

= = = = =

build.gradle (project-level)

buildscript {
    ext {
        gradle_version = '8.0.2'
        google_services_version = '4.3.10'
        kotlin_version = '1.8.0'
        kotlin_ktx_version = '1.1.0'
        android_support_version = '28.0.0'
        androidx_version = '1.1.0'
        crashlytics_version = '2.10.1'
        okhttp_version = '3.10.0'
        gson_version = '2.8.6'
        otto_version = '1.3.8'
    }

    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        // Make sure that you have the AGP plugin 8.1+ dependency
        classpath 'com.android.application:com.android.application.gradle.plugin:8.1.4'
        classpath "com.android.tools.build:gradle:$gradle_version"
        classpath "com.google.gms:google-services:$google_services_version"
        classpath 'com.google.firebase:firebase-plugins:2.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // Add the Crashlytics Gradle plugin (use v2.0.0+ if you built
        // your app with Android Studio 4.1).
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://maven.google.com/" }
        maven { url "https://jitpack.io" }
    }
}

build.gradle (app-level)

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'org.sonarqube'

...

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    signingConfigs {
        release {
            ...
        }
    }
    compileSdkVersion 34
    defaultConfig {
        applicationId "com.xxx.xxx"
        minSdkVersion 23
        targetSdkVersion 34
        versionCode xxx
        versionName 'xx.xx.xx'
        signingConfig signingConfigs.release
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
        multiDexEnabled true
    }

    flavorDimensions "type"

    productFlavors {
        // Override defaultConfig
        dev {
            resourceConfigurations += ['en', 'xxhdpi']
            applicationIdSuffix ".dev"
            dimension "type"
            firebaseCrashlytics {
                mappingFileUploadEnabled false
            }
        }
        prod {
            // must have prod block or system will use dev
            dimension "type"
            firebaseCrashlytics {
                mappingFileUploadEnabled true
            }
        }
    }
    buildTypes {
        debug {
            crunchPngs false
            minifyEnabled false
            splits.abi.enable = false
            splits.density.enable = false
            aaptOptions.cruncherEnabled = false
            ext.alwaysUpdateBuildId = false
            ext.enableCrashlytics = false
        }
        release {
            crunchPngs true
            minifyEnabled true
            shrinkResources true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    buildFeatures {
        viewBinding true
    }

    kotlinOptions {
        jvmTarget = '17'
    }
    namespace 'com.xxx.xxx'
    lint {
        checkReleaseBuilds false
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    ...
    
    // firebase
    implementation 'com.google.firebase:firebase-core:21.1.1'
    implementation 'com.google.firebase:firebase-messaging:24.0.0'
    implementation 'com.google.firebase:firebase-auth:19.1.0' // not necessary(required for signout and sign in)
    implementation 'com.google.firebase:firebase-config:21.6.0'
    implementation 'com.google.firebase:firebase-invites:17.0.0'
    implementation 'com.google.firebase:firebase-dynamic-links:19.1.0'
    // Import the BoM for the Firebase platform
    implementation(platform("com.google.firebase:firebase-bom:33.0.0"))

    // Add the dependencies for the Crashlytics and Analytics libraries
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation("com.google.firebase:firebase-crashlytics")
    implementation("com.google.firebase:firebase-analytics")
    implementation 'com.google.gms:google-services:4.4.1'
    
   ...
}

Solution

  • Finally I found that the firebase_crashlytics_collection_enabled is always set to false. I changed it to be true and now it works.

    <meta-data
                android:name="firebase_crashlytics_collection_enabled"
                android:value="true" />