Xamarin android App crashes with error android.runtime.JavaProxyThrowable reported in Google Play Console Vitals

Ovais Khan 1 Reputation point
2021-06-02T01:06:17.37+00:00

My app works perfectly fine both in debug and release mode. But in Google play store vitals section there are 3000+ crashes reported within a weeks time with stacktrace as shown below. It looks like app is crashing in BroadcastReceiver on ActionBootCompleted, ActionDateChanged and ActionTimeChanged events. I am not able to understand this log so as to figure out the reason for so many crashes for almost every devices as reported in play store console. Kindly help.

CRASH 1:

android.runtime.JavaProxyThrowable: at SQLite.SQLite3.Prepare2 (SQLitePCL.sqlite3 db, System.String query) [0x0001b] in <e6176266e10e4143a13a15e20e5b743c>:0
at SQLite.SQLiteCommand.Prepare () [0x00011] in <e6176266e10e4143a13a15e20e5b743c>:0
at SQLite.SQLiteCommand.ExecuteScalar[T] () [0x00030] in <e6176266e10e4143a13a15e20e5b743c>:0
at SQLite.SQLiteConnection.ExecuteScalar[T] (System.String query, System.Object[] args) [0x0003a] in <e6176266e10e4143a13a15e20e5b743c>:0
at myPackageName.Database.GetIntQuery (System.String query) [0x0002a] in <809af0b6f0d1412384da8eba135166d9>:0
at myPackageName.OnDateTimeChangeReciever.OnReceive (Android.Content.Context context, Android.Content.Intent intent) [0x00032] in <809af0b6f0d1412384da8eba135166d9>:0
at Android.Content.BroadcastReceiver.n_OnReceive_Landroid_content_Context_Landroid_content_Intent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_context, System.IntPtr native_intent) [0x00017] in <cbbabc5429d44d1b8e99c2e5c70fc4fc>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.1(intptr,intptr,intptr,intptr)
at crc642451e40f8204bea1.OnDateTimeChangeReciever.n_onReceive (Native Method)
at crc642451e40f8204bea1.OnDateTimeChangeReciever.onReceive (Unknown Source)
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3989)
at android.app.ActivityThread.access$1400 (ActivityThread.java:268)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1993)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:7811)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1068)

CRASH 2:

android.runtime.JavaProxyThrowable: at myPackageName.OnBootNotificationAlertReciever.OnReceive (Android.Content.Context context, Android.Content.Intent intent) [0x00083] in <809af0b6f0d1412384da8eba135166d9>:0
at Android.Content.BroadcastReceiver.n_OnReceive_Landroid_content_Context_Landroid_content_Intent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_context, System.IntPtr native_intent) [0x00017] in <cbbabc5429d44d1b8e99c2e5c70fc4fc>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.1(intptr,intptr,intptr,intptr)
at crc642451e40f8204bea1.OnBootNotificationAlertReciever.n_onReceive (Native Method)
at crc642451e40f8204bea1.OnBootNotificationAlertReciever.onReceive (Unknown Source)
at android.app.ActivityThread.handleReceiver (ActivityThread.java:4229)
at android.app.ActivityThread.access$1700 (ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2113)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8167)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Support.V4.App;

namespace myPackageName
{
    [BroadcastReceiver]
    class OnDateTimeChangeReciever : BroadcastReceiver
    {
        public OnDateTimeChangeReciever()
        {

        }
        public override void OnReceive(Context context, Intent intent)
        {
            if (intent.Action.Equals(Intent.ActionDateChanged) || intent.Action.Equals(Intent.ActionTimeChanged))
            {
                Intializer i = new Intializer();
                Database db = new Database();
                MyGlobals.ShowTimes = db.GetIntQuery("select value from Prayer where id =14");
                double latcheck = db.GetDoubleQuery("select value from PraySettings where id =22");
                double lngcheck = db.GetDoubleQuery("select value from PraySettings where id =23");
                if (MyGlobals.ShowTimes == 1 & MyGlobals.Latitude != 99999999 & MyGlobals.Logitude != 99999999)
                {
                    i.SetNextAlarm(context, 666);
                }
                if (db.GetIntQuery("Select value from Settings where id =15;").ToString() == "1")
                {
                    i.SetAlarm(context, 08, 00, 00, 1);
                }
                if (db.GetIntQuery("Select value from Settings where id =16;").ToString() == "1")
                {
                    i.SetAlarm(context, 20, 00, 00, 2);
                }
                db = null;
                i = null;
            }
        }
    }


}

        public int GetIntQuery(string query) 
        {
            string dbPath = Path.Combine (
                System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal),
                "tzmpo_t.rar");

            int result = 0;
            if (File.Exists(dbPath))
            {
                using (var db = new SQLiteConnection(dbPath))
                {
                    result = db.ExecuteScalar<int> (query);

                    db.Close();
                } 


            }
            return result;


        }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Support.V4.App;
using Java.Lang;

namespace myPackageName
{
[BroadcastReceiver]
class OnBootNotificationAlertReciever : BroadcastReceiver
{
public OnBootNotificationAlertReciever()
{

    }
    public override void OnReceive(Context context, Intent intent)
    {
            if (intent.Action.Equals(Intent.ActionBootCompleted))
            {
                Database db = new Database();
                Intializer i = new Intializer();
                if (db.GetIntQuery("Select value from Settings where id =15;").ToString() == "1")
                {
                    i.SetAlarm(context, 08, 00, 00, 1);
                }
                if (db.GetIntQuery("Select value from Settings where id =16;").ToString() == "1")
                {
                    i.SetAlarm(context, 20, 00, 00, 2);
                }
                string date = db.GetStringQuery("Select value from Settings where id =23;").ToString();
                string time = db.GetStringQuery("Select value from Settings where id =24;").ToString();
                if (date != "0" & time != "0")
                {
                    Java.Util.Calendar nn = Java.Util.Calendar.Instance;
                    Java.Util.Calendar now = Java.Util.Calendar.Instance;

                    nn.Set(Java.Util.CalendarField.Year, int.Parse(date.Split('-')[0]));
                    nn.Set(Java.Util.CalendarField.Month, int.Parse(date.Split('-')[1]));
                    nn.Set(Java.Util.CalendarField.DayOfMonth, int.Parse(date.Split('-')[2]));
                    nn.Set(Java.Util.CalendarField.HourOfDay, int.Parse(time.Split('-')[0]));
                    nn.Set(Java.Util.CalendarField.Minute, int.Parse(time.Split('-')[1]));
                    nn.Set(Java.Util.CalendarField.Second, int.Parse(time.Split('-')[2]));

                    if (nn.TimeInMillis > now.TimeInMillis)
                    {
                        i.SetProfileSwitchAlarm_new(context, nn, 888);
                        i.SetProfileSwitchAlarm_new(context, nn, 777);


                    }
                    else
                    {
                        db.ExecuteQuery("update settings set value = 0 where id = 22;");
                        db.ExecuteQuery("update settings set value = 0 where id = 23;");
                        db.ExecuteQuery("update settings set value = 0 where id = 24;");
                        Android.Media.AudioManager audiomanager = null;
                        if (audiomanager == null)
                        {
                            audiomanager = (Android.Media.AudioManager)context.GetSystemService(Context.AudioService);
                        }
                        audiomanager.RingerMode = Android.Media.RingerMode.Normal;
                    }



                }
                MyGlobals.ShowTimes = db.GetIntQuery("select value from Prayer where id =14");
                double latcheck = db.GetDoubleQuery("select value from PSettings where id =22");
                double lngcheck = db.GetDoubleQuery("select value from PSettings where id =23");
                db = null;
                if (MyGlobals.ShowPrayerTimes == 1 & MyGlobals.Latitude != 99999999 & MyGlobals.Logitude != 99999999)
                {
                    i.SetNextAlarm(context, 666);
                }
                i = null;


            }
    }
}

}

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,296 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,790 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KallemSandeep-8232 31 Reputation points
    2023-04-05T11:12:32.91+00:00

    Any update on this crash fix ?

    0 comments No comments