Android Question Java Exception: java.lang.Exception: Sub was not found.

Declan

Well-Known Member
Licensed User
Longtime User
When I run my app in "Debug" all is OK.
But when I run under "Release" I get the following error:
B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Day of Week: Sunday
** Activity (main) Resume **
Current Date: 18/12/2016
New Selected Date: 01/12/2016
java.lang.Exception: Sub  was not found.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5631)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
 

Declan

Well-Known Member
Licensed User
Longtime User
I am calling the Sub from two Subs in the app.
The first Call from: Sub Activity_Create(FirstTime As Boolean)
B4X:
GetHomework(MyCalDate)
This works no problem.

The second Call from: Sub AnotherDatePicker1_Closed (Cancelled As Boolean, Date As Long)
B4X:
        If MyCalDateNew <> MyCalDate Then
            CallSubDelayed(Me, GetEvents(MyCalDateNew))
            CallSubDelayed(Me, GetSports(MyCalDateNew))
            CallSubDelayed(Me, GetHomework(MyCalDateNew))  <-------------
            MyCalDate = MyCalDateNew
        End If
Gives me the error:
B4X:
LogCat connected to: 0123456789ABCDEF
--------- beginning of main
--------- beginning of system
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Day of Week: Sunday
** Activity (main) Resume **
Current Date: 18/12/2016
New Selected Date: 01/12/2016
java.lang.Exception: Sub  was not found.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5631)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
The sub parameter (MyCalDateNew) has valid data.
Strange that the first call does not raise the error?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Is the GetHomeWork sub expecting the parameter to be have Long type?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Ignore that, to pass parameters, you should be using CallSubDelayed2
 
Upvote 0
Top