I'm getting this crash on few devices, but only on Android 4.
I'm on Firebase Android SDK 10.2.1 11.0.2. Deferring updating to the latest version because it forces update of Google Play Services as well, and many users continue to remain on older GPS versions.
Is anybody else seeing this problem?
Update: This was working earlier. Crashes started after I upgraded from Firebase SDK 9.4.0 to 10.2.1, and compileSdkVersion 23 to 25. Crash only happens on Android 4.4 (Kitkat 19)
Updated Exception:
Fatal Exception: java.lang.RuntimeException
at com.google.android.gms.internal.mz.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by o.kD: Failed to gain exclusive lock to Firebase Database's offline persistence. This generally means you are using Firebase Database from multiple processes in your app. Keep in mind that multi-process Android apps execute the code in your Application class in all processes, so you may need to avoid initializing FirebaseDatabase in your Application class. If you are intentionally using Firebase Database from multiple processes, you can only enable offline persistence (i.e. call setPersistenceEnabled(true)) in one of them.
at com.google.android.gms.internal.nb.zzN(Unknown Source)
at com.google.android.gms.internal.nb.(Unknown Source)
at com.google.android.gms.internal.mx.zza(Unknown Source)
at com.google.android.gms.internal.qd.zzgQ(Unknown Source)
at com.google.android.gms.internal.qu.zzHg(Unknown Source)
at com.google.android.gms.internal.qu.zza(Unknown Source)
at com.google.android.gms.internal.qv.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5): , while compiling: PRAGMA journal_mode
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:893)
at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:638)
at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:320)
at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:294)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:829)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:814)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:709)
at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:1039)
at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:256)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
at com.google.android.gms.internal.nb.zzN(Unknown Source)
at com.google.android.gms.internal.nb.(Unknown Source)
at com.google.android.gms.internal.mx.zza(Unknown Source)
at com.google.android.gms.internal.qd.zzgQ(Unknown Source)
at com.google.android.gms.internal.qu.zzHg(Unknown Source)
at com.google.android.gms.internal.qu.zza(Unknown Source)
at com.google.android.gms.internal.qv.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
I do have multiple processes in the app, but using the following code to abort Application.onCreate for sub processes.
#Override
public void onCreate() {
super.onCreate();
if (FirebaseApp.getApps(this).isEmpty()) {
// No firebase apps; we are in a non-main process
return;
}
// Firebase init and other custom logic
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
}
There is no SQLiteDatabaseLockedException in Firebase. This SQLiteDatabaseLockedException is thrown when you are using a SQLite database with Android and the database engine is unable to acquire a database lock that is needs to do its job.
If the statement is a [COMMIT] or occurs outside of an explicit transaction, then you can retry the statement. If the statement is not a [COMMIT] and occurs within a explicit transaction then you should rollback the transaction before continuing.
Edit: With the new edit of your detailed stack trace, i see what the error is. The error is occuring when you are setting setPersistenceEnabled(true). This must be done before doing anything else with your firebaseDatabase object. So, i recomand you using the following code:
public class HelperClass {
private static FirebaseDatabase firebaseDatabase;
public static FirebaseDatabase getDatabase() {
if (firebaseDatabase == null) {
firebaseDatabase = FirebaseDatabase.getInstance();
firebaseDatabase.setPersistenceEnabled(true);
}
return firebaseDatabase;
}
}
Related
I've an Android app which downloads file from Firebase Storage, It is working fine with Android API level 23 and above. However, For version like Android API level 16 it fails with following exception:
05-15 16:42:32.921 3909-3952/com.X.Y E/StorageException: StorageException has occurred.
An unknown error occurred, please check the HTTP result code and inner exception for server response.
Code: -13000 HttpResult: 0
Unable to open stream
java.io.IOException: Unable to open stream
at com.google.firebase.storage.StreamDownloadTask$zza.zzp(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask$zza.zza(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.run(Unknown Source)
at com.google.firebase.storage.StorageTask.zzl(Unknown Source)
at com.google.firebase.storage.zzq.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: android.os.RemoteException
at com.google.android.gms.internal.firebase_storage.zzp.<init>(Unknown Source)
at com.google.android.gms.internal.firebase_storage.zzp.zzb(Unknown Source)
at com.google.firebase.storage.StorageReference.zzd(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.zzn(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.zza(Unknown Source)
at com.google.firebase.storage.zzw.call(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask$zza.zzp(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask$zza.zza(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.run(Unknown Source)
at com.google.firebase.storage.StorageTask.zzl(Unknown Source)
at com.google.firebase.storage.zzq.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Code to download:
final StorageReference pathReference = mStoragePath.getReference().child(mRootPath + inPath);
final StreamDownloadTask downloadTask = pathReference.getStream();
Dependencies:
com.google.firebase:firebase-core:15.0.2
com.google.firebase:firebase-firestore:16.0.0
com.google.firebase:firebase-storage:15.0.2
This can maybe happen if google play services isn't updated on your phone. Make sure that you have the latest version.
If your version is up to date check in setContentLanguage you should use only 2 letters (E.g. "en"). Also you should check this answer in github which depend in your problem
I have a crash reported by Fabric that during the check for the availability of Google Play Services that on Android 5 devices a crash can occur, particularly in OnePlus, Sony and Zuk devices.
I do not explicitly call this code directly and seems to be invoked by Google's own code.
According to other posts the exeption is thrown when the Parcel is too large, however since I do not control the process, my own code is not responsible for creating the Parcel.
I have checked the release notes for Google Play Services and other posts for no avail. Any suggestions are welcome.
Fatal Exception: java.lang.RuntimeException: Package manager has died
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:112)
at com.google.android.gms.common.zzo.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.common.zze.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.common.GoogleApiAvailability.getInstance(Unknown Source)
at com.google.android.gms.common.api.internal.zzbr.connect(Unknown Source)
at com.google.android.gms.common.api.internal.zzbp.zzb(Unknown Source)
at com.google.android.gms.common.api.internal.zzbp.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by android.os.TransactionTooLargeException
at android.os.BinderProxy.transactNative(Binder.java)
at android.os.BinderProxy.transact(Binder.java:496)
at android.content.pm.IPackageManager$Stub$Proxy.getPackageInfo(IPackageManager.java:1876)
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:107)
at com.google.android.gms.common.zzo.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.common.zze.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.common.GoogleApiAvailability.getInstance(Unknown Source)
at com.google.android.gms.common.api.internal.zzbr.connect(Unknown Source)
at com.google.android.gms.common.api.internal.zzbp.zzb(Unknown Source)
at com.google.android.gms.common.api.internal.zzbp.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
According to official Android documentation, the key to avoiding TransactionTooLargeException is to
keep all transactions relatively small. Try to minimize the amount of
memory needed to create a Parcel for the arguments and the return
value of the remote procedure call. Avoid transferring huge arrays of
strings or large bitmaps. If possible, try to break up big requests
into smaller pieces.
Although This question has been asked many time but they all are discussing about Sqlite Database. But in my Application I am using Content Provider for database. and I am using this for chat window.Using aSmack Lib.
Below is exception I am getting.
Fatal Exception: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(SQLiteConnection.java)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:806)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:791)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:1188)
at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:267)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
at com.adgyde.android.j.<init>(Unknown Source)
at com.adgyde.android.h.f(Unknown Source)
at com.adgyde.android.h.a(Unknown Source)
at com.adgyde.android.o.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5318)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:922)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:717)
Note:
I am getting this on fewer devices Like Vivo,Intex etc. But not on other devices Like Moto G,Samsung Note etc.
Some body has suggested about Write Storage permssion,Which I have declared in manifest. Other has suggested to ask at run time.
Please help me in right direction.
The following was working perfectly for months.
The code has recently started to break for the past few days without any changes on app side. Most probably Firebase broke something on their end and already logged in users have started to throw the following errors.
Firebase support is completely unresponsive, so asking it here.
Anybody still stuck on Firebase Please Help.
Code Used:
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if(user == null && !OAuth2Utilities.isBlocked(context)){
OAuth2Utilities.initAnonymousFirebaseAccount(context.getApplicationContext());
return null;
}
String userId = user.getUid();
Task<GetTokenResult> z1 = user.getToken(false);//true means it force refreshes the token, false means will update only if expired-- token by default expires in an hour
try {
Tasks.await(z1);
} catch (Exception e) {
e.printStackTrace();
}
final String z2 = z1.getResult().getToken();
Error Message:
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
W/System.err: java.util.concurrent.ExecutionException: com.google.firebase.auth.FirebaseAuthInvalidUserException: The user's credential is no longer valid. The user must sign in again.
W/System.err: at com.google.android.gms.tasks.Tasks.zzb(Unknown Source)
W/System.err: at com.google.android.gms.tasks.Tasks.await(Unknown Source)
W/System.err: at *private*.OAuth2Utilities.getFundaForOAuth2(OAuth2Utilities.java:52)
W/System.err: at *private*.AsyncTask.PostFetchAsyncTask.doInBackground(PostFetchAsyncTask.java:60)
W/System.err: at *private*.AsyncTask.PostFetchAsyncTask.doInBackground(PostFetchAsyncTask.java:48)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:288)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err: at java.lang.Thread.run(Thread.java:818)
W/System.err: Caused by: com.google.firebase.auth.FirebaseAuthInvalidUserException: The user's credential is no longer valid. The user must sign in again.
W/System.err: at com.google.android.gms.internal.zzago.zzew(Unknown Source)
W/System.err: at com.google.android.gms.internal.zzagl$zzg.zza(Unknown Source)
W/System.err: at com.google.android.gms.internal.zzagw.zzex(Unknown Source)
W/System.err: at com.google.android.gms.internal.zzagw$zza.onFailure(Unknown Source)
W/System.err: at com.google.android.gms.internal.zzagr$zza.onTransact(Unknown Source)
W/System.err: at android.os.Binder.execTransact(Binder.java:446)
If the same app is working for everyone except a specific user, it is possible that that user changed password or reset the password since last login, and Firebase Authentication requires the user to re-login for security reason.
Since FirebaseAuthInvalidUserException was thrown from user.getToken(), your app should ask the user to login again.
I'm using react native in Android and I'm hoping to download files from Firebase Storage.
But I'm getting this error when I use firebase storage .getDownloadUrl() method
(NB: The database works just fine)
Could not close WebSocket connection for id 0
java.net.SocketException: Socket is closed
at com.android.org.conscrypt.OpenSSLSocketImpl.checkOpen(OpenSSLSocketImpl.java:247)
at com.android.org.conscrypt.OpenSSLSocketImpl.-wrap0(OpenSSLSocketImpl.java)
at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:756)
at okio.Okio$1.write(Okio.java:80)
at okio.AsyncTimeout$1.write(AsyncTimeout.java:155)
at okio.RealBufferedSink.flush(RealBufferedSink.java:221)
at com.squareup.okhttp.internal.ws.WebSocketWriter.writeControlFrame(WebSocketWriter.java:151)
at com.squareup.okhttp.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:112)
at com.squareup.okhttp.internal.ws.RealWebSocket.close(RealWebSocket.java:135)
at com.facebook.react.modules.websocket.WebSocketModule.close(WebSocketModule.java:186)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:343)
at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:187)
at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:62)
at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:432)
at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(Native
Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:148)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:187)
at java.lang.Thread.run(Thread.java:818)
version:
react-native: 0.25.1
I don't get this error in my IOS emulator
Any help would be appreciated,