How to fix a “SQLiteConnection for gms database” that was leaked

My application, which uses Google Play Services, received the following warning in the logcat

 12-06 12:53:58.240 2748-2757/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/data/com.google.android.gms/databases/metrics.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
    12-06 12:53:58.240 2748-2757/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/data/com.google.android.gms/databases/help_responses.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
    12-06 12:53:58.240 2748-2757/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/data/com.google.android.gms/databases/auto_complete_suggestions.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.

…but unlike all the other cases discussed on SO, my application does not use any databases,

rather, it seems to be a leak from a database of Google Play Services.

How would one fix that?

Enquirer: Jo Mo

||

Solution #1:

In Android Studio on Android Monitor right corner change from “Firebase” to “Show only selected application”

Respondent: Jo Mo

Solution #2:

I guess if you clear data from google play store, it would be fine!

Settings->Apps->Google Play Services->MANAGE SPACE->CLEAR ALL DATA

Respondent: Minis

Solution #3:

Instead of using Run ‘app’ where I kept on getting those warning messages,

I used Debug ‘app’, whereupon I was informed that I had the following error:

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

This made sense because my activity extended AppCompatActivity

and in the Manifest I had designated android:theme="@android:style/Theme.NoDisplay"

which is evidently not a descendant of Theme.AppCompat.

I saw the advice to extend my activity to good old Activity, and it worked!

In fact, a short time later the original warning messages recurred and my app stopped working, so I haven’t answered the original question 🙁

Respondent: Mohammad Zarei

Solution #4:

this error is just because you do not declare any default constructor in your data class which is accessed by firebase database just create a blank default constructor and it will be fine!

Respondent: Jo Mo

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.