Reputation: 349
I am beginner to android program getting below error, tried solution provided like clearing Google play store data on Emulator still getting same error, not using any database connection code but getting database was leaked, any help would be appreciated.
Error
03-25 17:16:41.664 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/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.
03-25 17:16:41.669 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/help_responses.db.18' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
03-25 17:16:41.671 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/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.
03-25 17:20:42.080 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/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.
03-25 17:20:42.082 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/help_responses.db.18' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
03-25 17:20:42.376 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/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.
Activity A.java
package com.lifecycle.activity.demo.activity_lifecycle;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class ActivityA extends AppCompatActivity {
Button btt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btt = (Button) findViewById(R.id.button);
btt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(ActivityA.this, ActivityB.class);
startActivity(i);
}
});
Log.i("Activity A","onCreate");
}
@Override
protected void onStart() {
super.onStart();
Log.i("Activity A","onStart");
}
@Override
protected void onResume() {
super.onResume();
Log.i("Activity A","onResume");
}
@Override
protected void onPause() {
super.onPause();
Log.i("Activity A","onPause");
}
@Override
protected void onStop() {
super.onStop();
Log.i("Activity A","onStop");
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.i("Activity A","onDestroy");
}
@Override
protected void onRestart() {
super.onRestart();
Log.i("Activity A","onRestart");
}
}
ActivityB.java
package com.lifecycle.activity.demo.activity_lifecycle;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
/**
* Created by karthicklove on 25/03/17.
*/
public class ActivityB extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_b);
Log.i("Activity B","onCreate");
}
@Override
protected void onStart() {
super.onStart();
Log.i("Activity B","onStart");
}
@Override
protected void onResume() {
super.onResume();
Log.i("Activity B","onResume");
}
@Override
protected void onPause() {
super.onPause();
Log.i("Activity B","onPause");
}
@Override
protected void onStop() {
super.onStop();
Log.i("Activity B","onStop");
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.i("Activity B","onDestroy");
}
@Override
protected void onRestart() {
super.onRestart();
Log.i("Activity B","onRestart");
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.lifecycle.activity.demo.activity_lifecycle.ActivityA">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_name1"
tools:layout_constraintTop_creator="1"
android:layout_marginStart="134dp"
android:layout_marginTop="216dp"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="134dp" />
</android.support.constraint.ConstraintLayout>
activity_b.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/activity_b" />
</LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lifecycle.activity.demo.activity_lifecycle">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ActivityA">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ActivityB"></activity>
</application>
</manifest>
Upvotes: 1
Views: 5312
Reputation: 838
I think what you are observing is not coming from your app but the GMS service:
03-25 17:16:41.664 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/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.
03-25 17:16:41.669 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/help_responses.db.18' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
03-25 17:16:41.671 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/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.
03-25 17:20:42.080 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/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.
03-25 17:20:42.082 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/help_responses.db.18' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
03-25 17:20:42.376 2335-2344/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/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.
If it where from you application the package shown will be
com.lifecycle.activity.demo.activity_lifecycle
Upvotes: 2