Firebase: The database '/google_app_measurement_local.db' is not open - android

After having started using Firebase for event logging in my android app I keep getting these error messages when I fire up my app:
E/System: java.lang.IllegalStateException: The database '/...folder here.../google_app_measurement_local.db' is not open.
at android.database.sqlite.SQLiteDatabase.throwIfNotOpenLocked(SQLiteDatabase.java:2169)
at android.database.sqlite.SQLiteDatabase.createSession(SQLiteDatabase.java:365)
at android.database.sqlite.SQLiteDatabase$1.initialValue(SQLiteDatabase.java:84)
at android.database.sqlite.SQLiteDatabase$1.initialValue(SQLiteDatabase.java:83)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at android.database.sqlite.SQLiteDatabase.getThreadSession(SQLiteDatabase.java:359)
at android.database.sqlite.SQLiteProgram.getSession(SQLiteProgram.java:101)
at android.database.sqlite.SQLiteQuery.setLastStmt(SQLiteQuery.java:96)
at android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:111)
at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:300)
at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:366)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:202)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:185)
at java.lang.Thread.run(Thread.java:818)
Here's a snippet from my build.gradle:
dependencies {
compile 'com.android.support:support-v4:25.0.0'
compile 'com.google.firebase:firebase-analytics:9.8.0'
compile 'com.google.firebase:firebase-crash:9.8.0'
compile files('src/main/resources/simple-xml-2.7.jar')
compile files('src/main/resources/date4j.jar')
compile 'com.android.support:appcompat-v7:25.0.0'
compile files('src/main/resources/picasso-2.5.2.jar')
}
All I do is call
_firebaseAnalytics = FirebaseAnalytics.getInstance(context);
and then
_firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE, payload);
I have not been able to find any solutions online and am now hoping for help here...

Please move to latest version of firebase SDK. Firebase solved this memory leak issue in their updated sdk. Remove your old SDK and add below line in your gradle file.
compile 'com.google.firebase:firebase-core:11.0.1'

I have just faced with this when enabling strictmode, when adding
compile 'com.google.firebase:firebase-core:9.8.0'
I had to use earlier version:
compile 'com.google.firebase:firebase-core:9.6.0'
I've found latest version from Firebase Android SDK Release Notes

Related

Failed resolving dependencies due to OneSignal

I found the following question: Failed to resolve: com.android.support:customtabs:[26.0.0,26.1.0]
People marked it as duplicate (which is wrong ! see next sentence) or wrote something about Maven or cleaning project etc.
I have exactly the same problem for two days (failed to resolve customtabs and support-v4) and I did not change anything in my project which has been previously working. So I started looking for possible solutions and I found the problem - it is the OneSignal dependency - when I remove it, everything works fine. But I have already implemented notifications in my app - and don't know what to do now. I tried to compile the newest one (mentioned on OneSignal page)
compile 'com.onesignal:OneSignal:[3.6.0,3.99.99)'
But the result is same. Can anyone help?
UPDATE:
The problem can be very easy reproduced - please create a simple project and add this dependency mentioned below (it is from official OneSignal website https://documentation.onesignal.com/v3.0/docs/android-sdk-setup):
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
UPDATE 2:
These are my dependencies:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui-database:1.1.0'
compile 'com.android.support:design:25.3.1'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
Adding
maven {
url "https://maven.google.com"
}
to the build.gradle solved the problem with OneSignal, but now I have a problem with Firebase:
java.lang.NoSuchMethodError: No static method zzdD(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzv; or its super classes (declaration of 'com.google.android.gms.common.util.zzv'
The error happens because you have some conflicted library in your dependency.
As in the documentation, it says:
Automatic Dependencies
OneSignal automatically adds the following dependencies;
com.google.android.gms - Version 11
com.android.support - Version 26
Please makes sure your project matches these versions if you run into
a mismatch version error.
For more details see the All gms/firesbase libraries must use the
exact same version specification section.
So, you need to remove or use the same dependencies in your project, something like this:
compile 'com.android.support:appcompat-v7:26.0.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.0.+'
compile 'com.google.firebase:firebase-database:11.0.+'
compile 'com.firebaseui:firebase-ui-database:1.1.0'
compile 'com.android.support:design:26.0.+'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
Remove 'f' from dependency. also, use [ brackets instead of ). its a typo.
dependencies {
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
}
and this code in your root gradle file
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}

FCM integration in android, Why Firebase importing everything?

I have recently added FCM to my project and it's working fine. I have used
compile 'com.google.firebase:firebase-messaging:9.0.2'
this line for the library since messaging service is only required. But when I have seen the external libraries dir there are many firebase classes which have no use in my app. Please see the image below.
Edited : Here is the whole dependency clause
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'org.apache.httpcomponents:httpcore:4.4.3'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
}
apply plugin: 'com.google.gms.google-services'
You are including more libraries than you need because you are using the general play-services library and not using the split libraries like play-services-drive or some other specific library.
By using play-services:9.0.2 you are saying you want to include all libraries in Google Play services including all the Firebase ones.
Removing the play-services:9.0.2 dependency and replacing it with a specific one like play-services-drive:9.0.2 (depending on what APIs you want to use) should fix your issue.
I believe since you don't add the core lib dependency explicity. The messaging dependency downloads all of the Firebase one.
Try adding the core and messaging both to limit the things to messaging part
compile 'com.google.firebase:firebase-core:9.0.1'
compile 'com.google.firebase:firebase-messaging:9.0.1'

Compile time error for setServiceAccount() with FirebaseOptions.Builder()

I was working my Android app for sending push notifications using Firebase cloud messaging. I was setting up my server referring the guide https://firebase.google.com/docs/server/setup#prerequisites.
My project level build.gradle is like :
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
}
App level build.grade :
dependencies {
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.firebase:geofire:1.1.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.firebase:firebase-server-sdk:[3.0.0,)'
compile 'com.google.firebase:firebase-core:9.0.0'
}
I have created the service account credentials on the console as well but while I am initializing the SDK referring https://firebase.google.com/docs/server/setup#add_the_sdk
FirebaseOptions options = new FirebaseOptions.Builder()
.setServiceAccount
(new FileInputStream("path/to/serviceAccountCredentials.json"))
.setDatabaseUrl("https://databaseName.firebaseio.com/")
.build();
I am getting compile Error:(116, 21) error: cannot find symbol method setServiceAccount(FileInputStream)
I have checked many places but I am unable to find what I am doing wrong. Any help would be highly appreciated.
In your server project you need to use only the dependency:
com.google.firebase:firebase-server-sdk:[3.0.0,) and remove:
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.firebase:firebase-core:9.0.0'
The first is a server sdk while the others are client sdk and they will have conflicts if you try to use them together.
You're including a different version of the Firebase Database SDK than what you have for the other Firebase features:
compile 'com.firebase:firebase-client-android:2.5.2'
If you change it to:
compile 'com.google.firebase:firebase-database:9.0.0'
It will work better.
For more information, see the Firebase documentation for Android developers, from where I copied the line above.

Android studio getting stuck when run project

I have update the google play service version to 7.+, this version is required for GoogleApiClient, After updating google play version when i run project it will take much time and stuck entire computer.
Please guide.
thanks
Make sure to use required Google API in project. What you need in your project.
dependencies {
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-base:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
}
Note: Do not use complete google dependencies
dependencies {
compile 'com.google.android.gms:play-services:8.3.0'
}

Android Studio: Could not find any version that matches com.google.gms:play-services:6.1.+

I've recently updated my android studio and when I try to sync my gradle file I get the below error:
Could not find any version that matches com.google.gms:play-services:6.1.+
I understand that Android Studio ships with it's own sdk so I've installed the ADT sdk and pointed my project to this but I still get the same error, here are my gradle dependencies:
dependencies {
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.path:android-priority-jobqueue:1.1.2'
compile files('libs/Parse-1.4.2.jar')
compile project(':ws_wrapper')
compile project(':custom_slider_library')
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.google.android.gms:play-services:6.1.+'
compile project(':shinobicharts-android-library')
compile files('libs/shinobicharts-android-trial-1.3.5.jar')
compile files('libs/androidplot-core-0.6.1-SNAPSHOT.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
compile files('libs/universal-image-loader-1.9.2.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
}
I'm unsure as to what to do next, my sdk manager is up to date, does anyone have any ideas? I can't run this at the moment due to this issue.
If I try to add a dependency via the project structure the google play services isn't available on the maven drop down list.
Just to add this line #integer/google_play_services_version in the manifest is also causing an issue it says cannot resolve symbol
Your SDK isn't actually up-to-date. You need to install revision 12 of the Google Repository; that's the one that ships Google Play Services 6.1.11.

Categories

Resources