Getting error on dynamic component when using schema

Hello koders, I am using the dynamic component schema method to build my UI.
I am following this https://community.kodular.io/t/tutorials-from-a-z-how-to-create-schema-templates-with-dynamiccomponents-and-python/118235 to create schema. & my schema is

{
"name": "bar",
"metadata-version": 1,
"extension_version": 5,
"author": "bdkoder",
"platforms": [
    "creator.kodular.io"
],
"keys": ["id",
    "name",
    "image",
    "price",
    "weight"],
"components": [
    {
        "id": "Horizontal_Arrangement1{id}",
        "type": "HorizontalArrangement",
        "properties": {
            "AlignHorizontal": 2,
            "AlignVertical": 2,
            "BackgroundColor": 4294967295,
            "Width": -2
        },
        "components": [
            {
                "id": "Image1{id}",
                "type": "Image",
                "properties": {
                    "Height": -1012,
                    "Width": -1020,
                    "Picture": "{image}",
                    "ScalePictureToFit": true
                }
            },
            {
                "id": "Vertical_Arrangement1_copy{id}",
                "type": "VerticalArrangement",
                "properties": {
                    "AlignVertical": 2,
                    "Height": -2,
                    "Width": -1075
                },
                "components": [
                    {
                        "id": "Space4_copy{id}",
                        "type": "SpaceView",
                        "properties": {
                            "Height": -1002
                        }
                    },
                    {
                        "id": "Horizontal_Arrangement2_copy{id}",
                        "type": "HorizontalArrangement",
                        "properties": {
                            "AlignVertical": 2,
                            "Width": -2
                        },
                        "components": [
                            {
                                "id": "title{id}",
                                "type": "Label",
                                "properties": {
                                    "FontSize": 18,
                                    "FontTypeface": 1,
                                    "FontTypefaceImport": "Poppins-Bold.ttf",
                                    "Width": -2,
                                    "Text": "{name}",
                                    "TextColor": 4279111449
                                }
                            },
                            {
                                "id": "price{id}",
                                "type": "Label",
                                "properties": {
                                    "FontSize": 16,
                                    "FontTypeface": 5,
                                    "Text": "{price}"
                                }
                            }
                        ]
                    },
                    {
                        "id": "Horizontal_Arrangement3_copy{id}",
                        "type": "HorizontalArrangement",
                        "properties": {
                            "Height": -2,
                            "Width": -2
                        },
                        "components": [
                            {
                                "id": "weight{id}",
                                "type": "Label",
                                "properties": {
                                    "BackgroundColor": 4294967295,
                                    "FontSize": 16,
                                    "FontTypeface": 1,
                                    "Text": "{weight}",
                                    "TextColor": 4290032823
                                }
                            },
                            {
                                "id": "Space3_copy{id}",
                                "type": "SpaceView",
                                "properties": {
                                    "Width": -2
                                }
                            },
                            {
                                "id": "cart{id}",
                                "type": "Label",
                                "properties": {
                                    "BackgroundColor": 4293848814,
                                    "Clickable": true,
                                    "FontSize": 20,
                                    "Height": 30,
                                    "Width": 30,
                                    "Text": "+",
                                    "TextAlignment": 1,
                                    "TextColor": 4292619845
                                }
                            }
                        ]
                    }
                ]
            },
            {
                "id": "Space5_copy{id}",
                "type": "SpaceView",
                "properties": {
                    "Width": -1004
                }
            }
        ]
    }
]
}

& getting this error Runtime Error
java.lang.IllegalArgumentException: method com.google.appinventor.components.runtime.HVArrangement.BackgroundColor argument 1 has type int, got java.lang.Long

Error seems in your color code. It is in long format however, it must be an integer.
You should try to replace all your color code to other color code that are int. You should try -1 as cor code it is code of white color. Then try it if it works?

1 Like

it’s works. but what the problem with auto generate color code

I can’t say . You can use Kodular in built color for that. Just do it on color that you want to use. It will give you the code of that color and then you can use it in schema. Or also you can try color utility component.

Thank you for your help

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.