Unknown Component Error

Hello App Inventors,

Today when i was builing my local ai2 I encountered an error named Unknown Component Error when i tried to add new visible component. I also made the corresponding mock for the component. Below is my debug log:-


[ERROR] java.lang.UnsupportedOperationException: unknown component: RatingBar

* Unknown.Exception_0(ode-0.js)
* Unknown.RuntimeException_0(ode-0.js)
* Unknown.new UnsupportedOperationException_0(ode-0.js)
* Unknown.createMockComponent(ode-0.js)
* Unknown.$getCachedMockComponent(ode-0.js)
* Unknown.$getImage(ode-0.js)
* Unknown.new SimplePaletteItem(ode-0.js)
* Unknown.$addComponent_5(ode-0.js)
* Unknown.$loadComponents_0(ode-0.js)
* Unknown.new YaFormEditor(ode-0.js)
* Unknown.$addFormEditor(ode-0.js)
* Unknown.$loadProject(ode-0.js)
* Unknown.execute_68(ode-0.js)
* Unknown.runScheduledTasks(ode-0.js)
* Unknown.$flushPostEventPumpCommands(ode-0.js)
* Unknown.execute_145(ode-0.js)
* Unknown.execute_144(ode-0.js)
* Unknown.apply_10(ode-0.js)
* Unknown.entry0(ode-0.js)
* Unknown.anonymous(ode-0.js)
* Unknown.callback(ode-0.js)

Any help will be appreciated

Make sure you have :

  1. Made mock of component
  2. Defined mock in Simple component descriptor
  3. Added nonVisible=true/false in designerproperty
1 Like

Yes i did all of the steps.. but it still didnt resolved all the errors. When i removed the rating bar still it shows the error

What about component icon?

@Know_About_IT fixed my error .. Actually I was complexifying the mock so he did a fix.

1 Like

What about posting solution here?
Since question was asked to everyone so solution should also be available to everyone.

1 Like

Perhaps he messed amongst classes and he just wanted to add a simple (image) mock

So i asked him to remove those

here is code for mock

package com.google.appinventor.client.editor.simple.components;

import com.google.appinventor.client.editor.simple.SimpleEditor;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.SimplePanel;

public class MockRatingBar extends MockVisibleComponent {

    private final Image mockImage = new Image(images.mockRatingBar());

    public static final String TYPE = "RatingBar";

    public MockRatingBar(SimpleEditor editor) {
        super(editor, TYPE, images.ratingBar());
        SimplePanel widget = new SimplePanel();
        widget.setStylePrimaryName("ode-SimpleMockContainer");
        widget.addStyleDependentName("centerContents");
        widget.setWidget(mockImage);
        initComponent(widget);
    }


    @Override
    public int getPreferredWidth() {
        return mockImage.getWidth();
    }

    @Override
    int getWidthHint() {
        int widthHint = super.getWidthHint();
        if (widthHint == LENGTH_PREFERRED) {
            widthHint = LENGTH_FILL_PARENT;
        }
        return widthHint;
    }

}
1 Like

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