Uncaught exception in Firebase runloop (3.0.0)
We are facing the same issue on version 9.0.2
and 9.2.0
. After many hours of investigation, we found that one way to reproduce this issue is to have a query with fixed endAt
and startAt
parameters. Let me explain with a sample code:
// Firebase dependencies
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-database:9.2.0'
...
public class MainActivity extends AppCompatActivity {
private FirebaseDatabase m_Database;
private static boolean s_persistenceInitialized = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
m_Database = FirebaseDatabase.getInstance();
if (!s_persistenceInitialized) {
m_Database.setPersistenceEnabled(true);
s_persistenceInitialized = true;
}
m_Database.setLogLevel(Level.DEBUG);
}
@Override
protected void onStart() {
super.onStart();
long endAt = 100L; // Fixed value: CRASH on third app restart
// long endAt = new Date().getTime(); // Dynamic value: NO CRASH
getGoal("min_per_day", endAt, "some_uid");
}
private void getGoal(String p_goalId, long p_endAt, String p_uid) {
Query ref = m_Database.getReference("v0/data/meditation/goals").child(p_goalId).child(p_uid)
.orderByChild("time").endAt(p_endAt).limitToLast(1);
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Log.i("FB", "Snapshot: " + dataSnapshot);
}
@Override
public void onCancelled(DatabaseError error) {
Log.e("FB", "Error: " + error);
}
});
}
}
So the fixed endAt
param will crash the app on third start. I assume queries are cached to disk and then corrupted at some point if we recreate the same query from local cache multiple times (three). On the other hand, if endAt
is not fixed, for example current time in millis, then everything works as expected. The same applies for startAt
query parameter.
Uncaught exception in Firebase runloop (3.0.0) workaround for Strings
Looks like the problem has been solved in the latest update of the Firebase SDK,
Version 9.6 - September 21, 2016
https://firebase.google.com/support/release-notes/android#9.6
Why when i´m trying to write in Firebase Database I got this error? Related with FirebaseApp$IdTokenListener
my problem was solved just upgrading firebase database version to 17:
implementation 'com.google.firebase:firebase-database:17.0.0'
Hope it will help to someone.
Related Topics
Cannot Find Symbol Databindingcomponent on Android Studio 3.2 Canary 16 Kotlin Project
How to Change Package Name in Android Studio
Gridview with Different Cells Sizes, Pinterest Style
Display Data After Every 10 Seconds in Android
App Completely Restarting When Launched by Icon Press in Launcher
If I Call Getmeasuredwidth() or Getwidth() for Layout in Onresume They Return 0
Activate an Application When a Power Button Is Clicked
How to Ping a Url in an Android Service
What Is the "Ignoring Innerclasses Attribute" Warning Output During Compilation
Can't Upload Updated APK to Google Play Due to Different Certificate
How to Create a Number Picker Dialog
How to Attach Android Source to Eclipse
Disable Soft-Keyboard from Edittext But Still Allow Copy/Paste
Render Error in Android Studio 3.0 Layout Editor
Need to Disable Expand on Collapsingtoolbarlayout for Certain Fragments
How to Add External Jar Libraries to an Android Project from the Command Line