Android Question Service crash

fishwolf

Well-Known Member
Licensed User
Longtime User
I have a simple service that work fine on many devices, but on Samsung Core Plus don't start.

I cannot do a debug, but i think that is not a application problem

Any idea ?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User
You need to see the logs. Without the logs it is impossible to say what is the problem.

i have only this (google play report) and i haven't a dobble variable into my application

B4X:
java.lang.RuntimeException: Unable to create service domain.application.scheduler:
java.lang.RuntimeException: java.lang.NumberFormatException: Invalid double: "null"
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2697)
at android.app.ActivityThread.access$1700(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1404)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.NumberFormatException: Invalid double: "null"
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:201)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
at it.software.castiel.infoagility.scheduler.onCreate(scheduler.java:45)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2687)
... 10 more
 
Last edited:
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User
both the 2 erorrs received are from 4.4 Android version.

i have tried on motorola 4.4.4 and work fine.
 
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User
Is this the full stack trace?

Can you post the code in Service_Create?
B4X:
Sub Service_Create

   Log ("Service_Create")
  
   Main.gService = True
  
   Common.LoadProfile

   Notif.Initialize
   Notif.Icon = "notification"
   Notif.Sound = False  
   Notif.Vibrate = False
   Notif.Light = False
   Notif.OnGoingEvent=True
   Notif.AutoCancel = True

    
   NotifSound.Initialize(2)
   NotifID = NotifSound.Load(File.DirAssets, "notification.ogg")
    
End Sub

Sub LoadProfile
Dim JsonString As String
Dim JSON As JSONParser
Dim GlobalMap As Map
Dim ResultMap As Map
Dim DataMap As Map
Dim DataList As List
Dim DialogMap As Map
Dim Ind As Int


   If File.Exists(File.DirInternal, "Profile.json") == False Then
     Return
   End If
  
   JsonString = File.GetText (File.DirInternal, "Profile.json")
 
   JSON.Initialize(JsonString)
    
   GlobalMap = JSON.NextObject
   ResultMap = GlobalMap.Get("Profile")
  
   Main.gParamEmail  = ResultMap.Get("Email")
   Main.gParamTipo  = ResultMap.Get("Tipo")
   Main.gParamDistanza  = ResultMap.Get("Distanza")
  
   DataList = ResultMap.Get("Binomi")
  
   DialogMap.Initialize
  
   ClearBinomi
  
   For Ind = 0 To DataList.Size - 1
     DataMap = DataList.Get(Ind)
     
     Main.gParamBinomi(Main.gIndBinomi).ID = DataMap.Get("id")
     Main.gParamBinomi(Main.gIndBinomi).Conduttore = DataMap.Get("conduttore")
     Main.gParamBinomi(Main.gIndBinomi).Concorrente = DataMap.Get("concorrente")
     Main.gIndBinomi = Main.gIndBinomi + 1
   Next

End Sub

B4X:
java.lang.RuntimeException: Unable to create service domain.application.scheduler: java.lang.RuntimeException: java.lang.NumberFormatException: Invalid double: "null"
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2812)
at android.app.ActivityThread.access$1900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5586)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.NumberFormatException: Invalid double: "null"
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:201)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
atdomain.application.scheduler.onCreate(scheduler.java:45)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2802)
... 10 more
Caused by: java.lang.NumberFormatException: Invalid double: "null"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.parseDouble(StringToReal.java:269)
at java.lang.Double.parseDouble(Double.java:295)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:610)
at domain.application.common._loadprofile(common.java:271)
at domain.application.scheduler._service_create(scheduler.java:227)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
... 13 more
 
Last edited:
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User
It happens in LoadProfile.
It is hard to say without seeing the whole code.

You can open the generated Java code (common.java) and check line 271. Assuming that the code wasn't modified.
i have a backup code of live app

271 line = mostCurrent._main._gparamtipo = (int)(BA.ObjectToNumber(_resultmap.Get((Object)("Tipo"))));

B4X:
_json.Initialize(_jsonstring);
 //BA.debugLineNum = 132;BA.debugLine="GlobalMap = JSON.NextObject";
_globalmap = _json.NextObject();
 //BA.debugLineNum = 133;BA.debugLine="ResultMap = GlobalMap.Get(\"Profile\")";
_resultmap.setObject((anywheresoftware.b4a.objects.collections.Map.MyMap)(_globalmap.Get((Object)("Profile"))));
 //BA.debugLineNum = 135;BA.debugLine="Main.gParamEmail  = ResultMap.Get(\"Email\")";
mostCurrent._main._gparamemail = BA.ObjectToString(_resultmap.Get((Object)("Email")));
 //BA.debugLineNum = 136;BA.debugLine="Main.gParamTipo  = ResultMap.Get(\"Tipo\")";
mostCurrent._main._gparamtipo = (int)(BA.ObjectToNumber(_resultmap.Get((Object)("Tipo"))));
 //BA.debugLineNum = 137;BA.debugLine="Main.gParamDistanza  = ResultMap.Get(\"Distanza\")";
mostCurrent._main._gparamdistanza = (int)(BA.ObjectToNumber(_resultmap.Get((Object)("Distanza"))));
 //BA.debugLineNum = 139;BA.debugLine="Log(\"gParamEmail=\" & Main.gParamEmail)";
anywheresoftware.b4a.keywords.Common.Log("gParamEmail="+mostCurrent._main._gparamemail);
 //BA.debugLineNum = 140;BA.debugLine="Log(\"gParamTipo=\" & Main.gParamTipo)";
anywheresoftware.b4a.keywords.Common.Log("gParamTipo="+BA.NumberToString(mostCurrent._main._gparamtipo));
 //BA.debugLineNum = 141;BA.debugLine="Log(\"gParamDistanza=\" & Main.gParamDistanza)";
anywheresoftware.b4a.keywords.Common.Log("gParamDistanza="+BA.NumberToString(mostCurrent._main._gparamdistanza));
 
Upvote 0
Top