"Internal Bug" For Extension That Compiled Successfully

I was just creating a new extension, and it compiled successfully, but when I imported it and dragged it, App Inventor said "An internal bug has occurred. Report a bug?".

This is the code.

package com.gordonlu.linearprogressbar;

import android.app.Activity;
import android.content.Context;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;

import android.widget.FrameLayout;
import android.view.View;
import android.widget.ProgressBar;
import com.google.appinventor.components.runtime.AndroidViewComponent;

import com.google.appinventor.components.common.PropertyTypeConstants;
import android.content.res.ColorStateList;

@DesignerComponent(
        version = 1,
        description = "An extension that indicates the progress of an operation using an animated linear bar.",
        category = ComponentCategory.EXTENSION,
        nonVisible = true,
        iconName = "https://docs.google.com/drawings/d/e/2PACX-1vQCI87PHLBF0jb8QWyYmIRQSjjNW3EFXf-qpsWCvBYkUQ9vEgPAB8SpxcMpblxNpbIYrjCjLrRLIU2c/pub?w=16&h=16")

@SimpleObject(external = true)
//Libraries
@UsesLibraries(libraries = "")
//Permissions
@UsesPermissions(permissionNames = "")

public class LinearProgressBar extends AndroidNonvisibleComponent {

    //Activity and Context
    private Context context;
    private Activity activity;
    public int color;
    public ProgressBar progressBar;

    public LinearProgressBar(ComponentContainer container){
        super(container.$form());
        this.activity = container.$context();
        this.context = container.$context();
    }

    @SimpleFunction(description = "Creates a progress bar in the given arrangement.")
    public void CreateProgressBar(AndroidViewComponent layout) {
        View view = layout.getView();
        FrameLayout fl = (FrameLayout) view;
        fl.addView(progressBar);
    }

    @SimpleProperty(category = PropertyCategory.APPEARANCE, description = "This property specifies the progress color of the progress bar.")
    public int ProgressColor() {
        return color;
    }

    @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_COLOR, defaultValue = "")
    @SimpleProperty (description = "This property specifies the progress color of the progress bar.")
    public void ProgressColor(int argb) {
        this.color = argb;
        progressBar.setProgressTintList(ColorStateList.valueOf(argb));
    }
}

Try to remove the assets folder from your device.

  • Android ≥ 10 (API ≥ 29):
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/
  • Android < 10 :
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/AppInventor/assets/

That error still happened. That dragging error happened on my computer, and when I attempt to drag the extension to the Viewer, that error appears.

Post a screenshot.

Ok, post the ext. and let me check this on my computer.

LinearProgressBar (3).aix (6.5 KB)

Click on ok and post the log here.

To create a progressbar, you should create a new instance of ProgressBar object.

ProgressBar progressBar = new ProgressBar(this.context);

This is the technical data

notes = Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36
foundIn = nb188a
faultData = com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) : Cannot set properties of null (setting 'yb')
projectId = 4584293858148352

Woops, I forgot, but it stil says an internal bug has occurred.

This part seems wrong / responsible for it:

    @SimpleProperty(description = "This property specifies the progress color of the progress bar.")
    @DesignerProperty(defaultValue = "", editorType = "color")
    public void ProgressColor(int i) {
        this.color = i;
        this.progressBar.setProgressTintList(ColorStateList.valueOf(i));
    }
1 Like

Hmm...same error. :woozy_face:

After removing this part, I was able to import the extension.

1 Like

I am also able to import the extension, the bug occurs only when I drag the extension to the Viewer.

Everything works fine when I remove:

@DesignerProperty(defaultValue = "", editorType = "color")

Something has gone wrong with it.

Thanks everybody for replying, I found the solution - I cannot leave defaultValue empty. I have to fill in a color.

@DesignerProperty(defaultValue = "&H00FFFFFF", editorType = "color")

Thank you all, especially @Anke (that is the closest answer I got)!

1 Like

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