So I have a app that is supposed to read and write data to googles firebase and its been working well for the past few years.
However a few days ago I wanted to update the app again so I finished my update and ran it but everytime I did something firebase related the app would crash with this error:
Invalid toNumber block operation
: empty String
Detailed error message:
java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at com.Bryan.K.SK.HomePageActivity$8.onClick(HomePageActivity.java:322)
at android.view.View.performClick(View.java:7792)
at android.view.View.performClickInternal(View.java:7769)
at android.view.View.access$3800(View.java:910)
at android.view.View$PerformClick.run(View.java:30218)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
It seems to be a empty firebase value issue I checked firebase and it was not empty and firebases rules are both true for read and write.
No matter what I do I can not figure this out since it worked just fine earlier. I should mention I am using a mobile app called sketchware to create this app.
What I click that crashes the app:
if (!connected) {
No_Int.setTitle("No Connection");
No_Int.setMessage("You do not have internet access. This page is only available through internet.");
No_Int.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface _dialog, int _which) {
}
});
No_Int.create().show();
}
else {
if ((Double.parseDouble(latest) == Double.parseDouble(your_version)) || (Double.parseDouble(latest) < Double.parseDouble(your_version))) {
NewD.setTitle("Whats New:");
NewD.setMessage(wnew);
NewD.setPositiveButton("Thanks!", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface _dialog, int _which) {
}
});
NewD.setCancelable(false);
NewD.create().show();
}
else {
NewD.setTitle("Not latest Version");
NewD.setMessage("Your app is not updated to the latest version.");
NewD.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface _dialog, int _which) {
}
});
NewD.setCancelable(false);
NewD.create().show();
}
}
The line that is supposed to get the latest version value from firebase but dosent:
latest = NewMap.get((int)0).get("Latest-V").toString();
Thanks in advance.