Android Question please help me to locate my code problem

Hi, I am learning how to create and compile a customized view into a library. (I am a newbie in programming)
The problem that has trapped me is that the app crashed on launch when I tested the library in a project.


here is the log:

The error infomation:
日志记录器已连接到:  Tianyi TYH632M
--------- beginning of main
--------- beginning of system
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Error occurred on line: 359 (B4XPagesManager)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1087)
    at b4a.testLib.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1068)
    at b4a.testLib.b4xpagesmanager._showpage(b4xpagesmanager.java:425)
    at b4a.testLib.b4xpagesmanager._addpage(b4xpagesmanager.java:245)
    at b4a.testLib.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:259)
    at b4a.testLib.b4xpagesmanager._initialize(b4xpagesmanager.java:165)
    at b4a.testLib.main._activity_create(main.java:415)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at b4a.testLib.main.afterFirstLayout(main.java:105)
    at b4a.testLib.main.access$000(main.java:17)
    at b4a.testLib.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:955)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:228)
    at android.app.ActivityThread.main(ActivityThread.java:9105)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:614)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1129)
Caused by: java.lang.RuntimeException: java.lang.Exception: Sub B4XPage_Created signature does not match expected signature.
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
    ... 24 more
Caused by: java.lang.Exception: Sub B4XPage_Created signature does not match expected signature.
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:321)
    ... 25 more
** Activity (main) Resume **

here is the code structure of my firstLib project which contains 3 modules named Main, B4XMainPage and TapCounter:

the Main module:
#Region  Project Attributes
    ...
    #LibraryName:firstLib
    #LibraryAuthor:zly
    #LibraryVersion:1.0
#End Region

...'other codes remain default


the B4XMainPage module:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private TapCounter1 As TapCounter
End Sub

...

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("Main")
End Sub

'A TapCounter has been added to the default layout through the designer.
Private Sub TapCounter_Click
    Log("Click,From TapCounter ")
End Sub

Private Sub TapCounter_LongClick
    Log("LongClick,From TapCounter")
End Sub

the TapCounter module (a custom view class):
#Event: Click
#Event: LongClick
#RaisesSynchronousEvents:Click
#RaisesSynchronousEvents:LongClick

'Several customer property
#DesignerProperty: Key: ...
#DesignerProperty: Key: ...
#DesignerProperty: Key: ...
#DesignerProperty: Key: ...
#DesignerProperty: Key: ...
#DesignerProperty: Key: ...
#DesignerProperty: Key: ...

...

Private Sub mbase_Touch (Action As Int, X As Float, Y As Float)

      ...  'implemented the click and long click event

end sub
...        'other implementation codes for TapCounter class

here is a brief information about my library and project:
firstLib: a standard b4a library I created, which contains a b4xpage project. In the b4xpage project, I implemented a customer view named TapCounter.
testLib: is a b4xpage project used to test the library. It is an empty project except that a TapCounter is added to the default layout through the designer.

I would appreciate it if someone could take some time to help me locate the problem.
 

Attachments

  • FirstLib.zip
    12.6 KB · Views: 114
  • testLib.zip
    10.2 KB · Views: 102
Top