Kodular Extension not working

Hello to anyone who is reading this. I’ve developed apps on Kodular without problems, but now its time for me advance my skills and start creating extensions. I have read through all extension threads and have read everyone’s response to issues pertaining to extensions and extension making. I decided to do a test run and make an extension with 1 block after watching many YouTube videos. Here is my code that I have started.

~ CODE ~

package io.makeroid.jc1bryan_82242.LightningKings;

import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.annotations.UsesPermissions;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
/import com.google.appinventor.components.annotations.;
import com.google.appinventor.components.runtime.;
import com.google.appinventor.components.common.
;
package com.google.appinventor.components.runtime;*/

@DesignerComponent(
version = 1,
description = “Extension made with Kodular IDE”,
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = “https://ide.kodular.io/assets/logo.png”)

@SimpleObject(external = true)
public final class LightningKings extends AndroidNonvisibleComponent {

/**
Creates a new component
*/

private int num1,num2;

public LightningKings(ComponentContainer container) {
super(container.$form());
}

@SimpleFunction(description="")
public void GetValue(int number1, int number2){
num1=number1;
num2=number2;
int res = num1+num2;
GotValue(res);
}
@SimpleEvent(description="")
public void GotValue(int result){
EventDispatcher.dispatchEvent(this, “GotValue”, result);
}
}

~ END CODE ~

Im not sure what the problem here is. If anyone would like to chip in and help, that would be greatly appreciated.

Last question is once i compile and create the extension, can i import it straight to my application? Heres a better example. “I download the extension from the email that was sent to me, I open it up and download it.” Can I then import it straight to my application?

Once again any help is appreciated. Thanks to all who give their advice and input! Have a great day!!

I did figure it out by doing more research. If anyone would like to give me some tips and advice that would be great thank you!

what about revealing what the solution to your issue was?
Taifun

1 Like

oh yeah sure

While I was scrolling through many threads and post, I came across alot of answered problems but people still not understanding where they went wrong. One guy said "just pay attention and read. Its all in the debugging info after the app has finished being compiled. My issue was just paying attention. I had 2 wrong spelling errors which it didnt day in the log but was would definetly be an issue later down the road. I was also missing this key piece of information.

import com.google.appinventor.components.runtime.EventDispatcher;

I still don’t truly understand the library part of this but i’m still learning. My first time doing this and I already solved 5 errors. Making sure you have the key libraries is very important. Dont have libraries that you dont need. Also read all the forum post because I saw a lot of answered posts that people didn’t bother to follow up on. Ill post my code snippet so all the new comers can have a chance to learn from my mistakes.

3 Likes

– THIS CODE WORKS FOR ALL NEW TO EXTENSIONS –

*Feel free to copy and paste the code into your program:+1: *

package io.makeroid.jc1bryan_82242.LightningKings;

import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.annotations.UsesPermissions;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
/import com.google.appinventor.components.annotations.;
import com.google.appinventor.components.runtime.;
import com.google.appinventor.components.common.
;
package com.google.appinventor.components.runtime;*/

@DesignerComponent(
version = 1,
description = “Extension made with Kodular IDE”,
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = “https://ide.kodular.io/assets/logo.png”)

@SimpleObject(external = true)
public final class LightningKings extends AndroidNonvisibleComponent {

/* Variables go here */
private int num1,num2;

/* Variables end here */

public LightningKings(ComponentContainer container) {
super(container.$form());
}

@SimpleFunction(description="")
public void GetValue(int number1, int number2){
num1=number1;
num2=number2;
int res = num1+num2;
GotValue(res);
}
@SimpleEvent(description="")
public void GotValue(int result){
EventDispatcher.dispatchEvent(this, “GotValue”, result);
}

}

2 Likes