Android Question [solved] Error: Field clv was declared with the wrong type.

ThePuiu

Active Member
Licensed User
Longtime User
I can't get rid of this error in my project. The error occurs when I define the CustomListView clv variable. The attached project is a test one and contains all the libraries that are in my project.
The content of the Log is:
B4X:
Logger connected to:  samsung SM-T825
--------- beginning of main
Copying updated assets files (3)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
Copying updated assets files (8)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 224 (B4XDrawer)
java.lang.RuntimeException: java.lang.RuntimeException: Field clv was declared with the wrong type.
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
    at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:292)
    at xxx.error.main._activity_create(main.java:394)
    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:144)
    at xxx.error.main.afterFirstLayout(main.java:104)
    at xxx.error.main.access$000(main.java:17)
    at xxx.error.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:216)
    at android.app.ActivityThread.main(ActivityThread.java:7266)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by: java.lang.RuntimeException: Field clv was declared with the wrong type.
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:430)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:453)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
    ... 19 more
** Activity (main) Resume **

Can you help me?
 

Attachments

  • error.zip
    20.2 KB · Views: 130

mangojack

Well-Known Member
Licensed User
Longtime User
With your test project as is , I cannot produce the same error.

I noticed you have CustomListView.bas class in your project files , but the module was not added to the project.

For a start I would remove the CustomListView.bas from your project files ... then check / include the core included xCustomListView library .
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I noticed you have CustomListView.bas class in your project files , but the module was not added to the project.
It doesn't create problems (of course if CustomListView library is selected).

I cannot test the project right now (but soon); anyway, I can read a very strange thing in the log, before the clv error, many times this line:
** Service (starter) Destroy (ignored)**
!!!
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
OK the answer is that CustomListview is declared twice. you have a CustomListView class in your project, and XUI Views contains a CustomListView Class. So if you are not using XUI Views for anything else you can remove that, or a better solution would be to rename the class in your project if that is the one you want to use or remove it if you intended to use the XUI Views custom list view. One of the classes is used in the designer so you will probably have to remove the view and re add it.
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
and XUI Views contains a CustomListView Class
Sorry, Steve, where is it?

1578880559421.png
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
In the manifest entry as a dependency which makes it available:

Version=2.22
B4J.DependsOn=jBitmapCreator, jXUI, jDateUtils, JavaObject, xCustomListView, B4XFormatter
B4A.DependsOn=BitmapCreator, XUI, DateUtils, xCustomListView, IME, JavaObject, B4XFormatter
B4i.DependsOn=iBitmapCreator, iXUI, iDateUtils, xCustomListView, B4XFormatter
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
If it is a dependency in the manifest and the library is available (in the internal or additional libraries) it will be available and loaded. So there shouldn't be a class in the project with the same name.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The library is xCustomListView, but the class name inside is CustomListView. There is a lot to get to grips with in the B4xlibs, we'll get there :)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
He almost certainly has a xCustomListView.jar library in the Additional or Internal folder, like me, "obviously" (Internal).

I removed the class from the project but then it was necessary to remove the CLV from the Drawer layout, add it again (it will be the right type) and clean the project, otherwise he will get the same error.
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
you guessed right LucaMs! After I deleted the file (xCustomListView.jar from AditionalLibrary) and redoed the project, everything seems to be ok. I used the class in the file (not from the library) because I had a small change made.
Thank you all!
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
you guessed right LucaMs! After I deleted the file (xCustomListView.jar from AditionalLibrary) and redoed the project, everything seems to be ok. I used the class in the file (not from the library) because I had a small change made.
Thank you all!
Me too (this answer right now); rename your modified class, so you can use one or the other when you want/need.
 
Upvote 0
Top