firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

FATAL EXCEPTION: main Process: java.lang.RuntimeException: Internal error in Cloud Firestore (25.0.0).

Open armanhovsepyan98 opened this issue 1 year ago • 9 comments

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Iguana | 2023.2.1 Patch 1
  • Firebase Component: (Database, Firestore, Storage, Functions, etc)
  • Component version: _____

[REQUIRED] Step 3: Describe the problem

Firestore is not working on several devices, and the app crashes with an error.

Relevant Code:

Screenshot 2024-05-15 161147

armanhovsepyan98 avatar May 16 '24 08:05 armanhovsepyan98

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar May 16 '24 08:05 google-oss-bot

Drive-by comment: This SQLiteDatabaseLockedException has been reported many times but we have never been able to reproduce or find the root cause: https://github.com/search?q=repo%3Afirebase%2Ffirebase-android-sdk+sqlitedatabaselockedexception&type=issues

dconeybe avatar May 16 '24 14:05 dconeybe

The log is from Android Studio I believe? Can you reproduce this somewhat consistently? If so, can you tell us your setup and environment, devices used and their versions? A minimum reproduction App would be greatly appreciated.

wu-hui avatar May 16 '24 15:05 wu-hui

The log is from Android Studio I believe? Can you reproduce this somewhat consistently? If so, can you tell us your setup and environment, devices used and their versions? A minimum reproduction App would be greatly appreciated.

Yes, it's from Android Studio logs. It constantly happens with Samsung phones (I tried on Android 10 and 12). I also tried on Pixel with different versions but did not have the problem. The app's minimum and target SDK versions are 27 and 34, respectively. BuildVariant - debug Firebase//
// Import the Firebase BoM (see: https://firebase.google.com/docs/android/learn-more#bom) implementation(platform("com.google.firebase:firebase-bom:33.0.0"))

// Firestore
implementation("com.google.firebase:firebase-firestore")

// Firebase Authentication
implementation("com.google.firebase:firebase-auth")

implementation("com.google.firebase:firebase-storage")

armanhovsepyan98 avatar May 16 '24 16:05 armanhovsepyan98

This is great information. Can you provide a specific Samsung device info. I'll try to get a device to test this.

wu-hui avatar May 21 '24 16:05 wu-hui

This is great information. Can you provide a specific Samsung device info. I'll try to get a device to test this.

I am using a Samsung A41 and an A52.

armanhovsepyan98 avatar May 22 '24 17:05 armanhovsepyan98

@wu-hui But as I understand, it's not only dependent on the device because when I create an empty project and connect to Firestore, it works. However, in some projects, it's throwing an exception only on Samsung phones in my case.

armanhovsepyan98 avatar May 22 '24 17:05 armanhovsepyan98

Solution for Cloud Firestore RuntimeException

If you're encountering a similar issue to @armanhovsepyan98, follow these steps to resolve it:


1. Update google-services version in android/build.gradle

Update the google-services plugin version to ensure compatibility with Firebase dependencies:

// From:
classpath 'com.google.gms:google-services:4.3.10'

// To:
classpath 'com.google.gms:google-services:4.3.15'

2. Disable minification/shrinking in android/app/build.gradle

Temporarily disable minifyEnabled and shrinkResources in the release build type:

buildTypes {
    release {
        signingConfig signingConfigs.release

        // Temporarily disable minification / shrinking
        minifyEnabled false
        shrinkResources false
    }
}

3. Update dependencies in android/app/build.gradle

Make the following changes to your dependencies:

  • Replace com.android.support:multidex with androidx.multidex.
  • Add the missing Firebase dependencies.
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.multidex:multidex:2.0.1'

    implementation platform('com.google.firebase:firebase-bom:33.8.0')
    implementation "com.google.firebase:firebase-firestore"
    implementation "com.google.firebase:firebase-auth"
    implementation "com.google.firebase:firebase-storage"
}

Additional Notes:

  • Ensure your Firebase dependencies are compatible with the firebase-bom version.

I think this issue is linked with #6365

mrnetforge avatar Jan 20 '25 21:01 mrnetforge