Android Question Error reported in Firebase

vbmundo

Well-Known Member
Licensed User
Hi,

The Play Store Console only show a few ANRs in my APP, but when I go to my Firebase Console I see a lot of errors reported..

The most frequently error is that

B4X:
Exception java.lang.IndexOutOfBoundsException: Invalid index 3, size is 3
java.util.ArrayList.throwIndexOutOfBoundsException (ArrayList.java:255)
java.util.Arrays$ArrayList.get (Arrays.java:66)
anywheresoftware.b4a.objects.collections.List.Get (List.java:117)
zetoox.mysql.main._activity_create (main.java:411)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
anywheresoftware.b4a.BA.raiseEvent2 (BA.java:169)
zetoox.mysql.main.afterFirstLayout (main.java:102)
zetoox.mysql.main.access$000 (main.java:17)
zetoox.mysql.main$WaitForLayout.run (main.java:80)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:135)
android.app.ActivityThread.main (ActivityThread.java:5910)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1405)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1200)

But I can see in what Activity and Code Line I have this error.

How can I see in what source line appears this error ?

Regards
 

DonManfred

Expert
Licensed User
Longtime User
IndexOutOfBoundsException: Invalid index 3, size is 3
You are accessing a list/array with threee items in it. But you are using the index 3 (not 2)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
in a project i just tested i have had a look at the main.java...

It looks like this in the example here... Please notethe comments (// comment)

public static String _sendchooser(String _strpath,String _strfile) throws Exception{
anywheresoftware.b4a.objects.collections.Map _mapskipforlist = null;
String _strpackagename = "";
anywheresoftware.b4a.phone.PackageManagerWrapper _pm = null;
anywheresoftware.b4a.objects.IntentWrapper _intent1 = null;
String _cn = "";
anywheresoftware.b4a.objects.drawable.BitmapDrawable _bdw = null;
//BA.debugLineNum = 60;BA.debugLine="Sub SendChooser(strPath As String, strFile As Stri";
//BA.debugLineNum = 62;BA.debugLine="uriX.Parse(\"file://\" & File.Combine(strPath, s";
mostCurrent._urix.Parse("file://"+anywheresoftware.b4a.keywords.Common.File.Combine(_strpath,_strfile));
//BA.debugLineNum = 64;BA.debugLine="Dim mapSkipForList As Map";
_mapskipforlist = new anywheresoftware.b4a.objects.collections.Map();
//BA.debugLineNum = 65;BA.debugLine="mapSkipForList.Initialize";
_mapskipforlist.Initialize();
//BA.debugLineNum = 66;BA.debugLine="mapSkipForList.Put(Application.PackageName, True)";
_mapskipforlist.Put((Object)(anywheresoftware.b4a.keywords.Common.Application.getPackageName()),(Object)(anywheresoftware.b4a.keywords.Common.True));
//BA.debugLineNum = 67;BA.debugLine="mapSkipForList.Put(\"com.google.android.apps.maps\"";
_mapskipforlist.Put((Object)("com.google.android.apps.maps"),(Object)(anywheresoftware.b4a.keywords.Common.True));
//BA.debugLineNum = 70;BA.debugLine="Dim strPackageName As String = \"\"";
_strpackagename = "";
//BA.debugLineNum = 71;BA.debugLine="Dim pm As PackageManager";
_pm = new anywheresoftware.b4a.phone.PackageManagerWrapper();
//BA.debugLineNum = 72;BA.debugLine="Dim Intent1 As Intent";
_intent1 = new anywheresoftware.b4a.objects.IntentWrapper();
//BA.debugLineNum = 73;BA.debugLine="Intent1.Initialize(Intent1.ACTION_SEND, \"file://\"";
_intent1.Initialize(_intent1.ACTION_SEND,"file://");
//BA.debugLineNum = 74;BA.debugLine="Intent1.SetType(\"image/*\")";
_intent1.SetType("image/*");
//BA.debugLineNum = 76;BA.debugLine="Log(\" \")";
anywheresoftware.b4a.keywords.Common.Log(" ");
//BA.debugLineNum = 77;BA.debugLine="For Each cn As String In pm.QueryIntentActivities";
final anywheresoftware.b4a.BA.IterableList group12 = _pm.QueryIntentActivities((android.content.Intent)(_intent1.getObject()));
final int groupLen12 = group12.getSize();
for (int index12 = 0;index12 < groupLen12 ;index12++){
_cn = BA.ObjectToString(group12.Get(index12));
//BA.debugLineNum = 78;BA.debugLine="strPackageName = cn.SubString2(0, cn.IndexOf(\"/\"";
_strpackagename = _cn.substring((int) (0),_cn.indexOf("/"));
//BA.debugLineNum = 79;BA.debugLine="If mapSkipForList.ContainsKey(strPackageName) Th";
if (_mapskipforlist.ContainsKey((Object)(_strpackagename))) {
//BA.debugLineNum = 80;BA.debugLine="Log(\" >> Skipped strPackageName=\" & strPacka";
anywheresoftware.b4a.keywords.Common.Log(" >> Skipped strPackageName="+_strpackagename);
}else {
//BA.debugLineNum = 82;BA.debugLine="Log(\"Used strPackageName=\" & strPackageName)";
anywheresoftware.b4a.keywords.Common.Log("Used strPackageName="+_strpackagename);
//BA.debugLineNum = 84;BA.debugLine="Dim bdw As BitmapDrawable = pm.GetApplicationIc";
_bdw = new anywheresoftware.b4a.objects.drawable.BitmapDrawable();
_bdw.setObject((android.graphics.drawable.BitmapDrawable)(_pm.GetApplicationIcon(_strpackagename)));
//BA.debugLineNum = 85;BA.debugLine="lv.AddTwoLinesAndBitmap2(pm.GetApplicationLabel";
mostCurrent._lv.AddTwoLinesAndBitmap2(_pm.GetApplicationLabel(_strpackagename),"",_bdw.getBitmap(),(Object)(_cn));
};
}
;
//BA.debugLineNum = 88;BA.debugLine="Log(\" \")";
anywheresoftware.b4a.keywords.Common.Log(" ");
//BA.debugLineNum = 90;BA.debugLine="End Sub";
return "";
}
}
 
Upvote 0

vbmundo

Well-Known Member
Licensed User
in a project i just tested i have had a look at the main.java...

It looks like this in the example here... Please notethe comments (// comment)

yes, I hope to identify the line of error, because the main.java file is much more extensive than the Main activity of my project.

Thanks
 
Upvote 0

vbmundo

Well-Known Member
Licensed User
Incredible... this is the Fail code

B4X:
    If StateManager.RestoreState(Activity, "Main", 60) = False Then
        If File.Exists(MySQL.Carpeta,"reg5.smql")=True Then
           TextoEncriptado=File.ReadString(MySQL.Carpeta,"reg5.smql")
           Texto=f.Decrypt(TextoEncriptado)
           valores=SplitMe(Texto,"\|")
           txtServidor.Text=valores.Get(0)
           txtPort.Text=valores.Get(1)
           txtUser.Text=valores.Get(2)
           txtPassword.Text=valores.Get(3)
        End If
    End If

the File have 4 fields, not 3.. I don't understand..

I will search more
 
Upvote 0

Stephanie lie

Member
Licensed User
java.lang.IndexOutOfBoundsException: Indeks: 3, Ukuran: 3
upload_2016-12-29_20-35-15.png
upload_2016-12-29_20-35-15.png
Incredible... this is the Fail code

B4X:
    If StateManager.RestoreState(Activity, "Main", 60) = False Then
        If File.Exists(MySQL.Carpeta,"reg5.smql")=True Then
           TextoEncriptado=File.ReadString(MySQL.Carpeta,"reg5.smql")
           Texto=f.Decrypt(TextoEncriptado)
           valores=SplitMe(Texto,"\|")
           txtServidor.Text=valores.Get(0)
           txtPort.Text=valores.Get(1)
           txtUser.Text=valores.Get(2)
           txtPassword.Text=valores.Get(3)
        End If
    End If

the File have 4 fields, not 3.. I don't understand..

I will search more
 
Upvote 0
Top