Getting error in extension building

pls help to solve this error 1st i build succesfull and and 2nd time if i build then getting this error if i restart my pc and build again then build sucessfully

$ ant extensions
Buildfile: C:\appinventor-sources\appinventor\build.xml

extensions:

clean:
[delete] Deleting directory C:\appinventor-sources\appinventor\components\bui ld

BUILD FAILED
C:\appinventor-sources\appinventor\build.xml:41: The following error occurred wh ile executing this line:
C:\appinventor-sources\appinventor\build-common.xml:257: Unable to delete file C :\appinventor-sources\appinventor\components\build\extensions\com.varsha.Materia lUiDesign.aix

Total time: 0 seconds
Picked up _JAVA_OPTIONS: -Xmx1024M

It may be possible that another process on your computer is referencing that file, preventing Windows from deleting it. For example, do you have it selected in the Windows Explorer? You may want to use a tool like Process Explorer to see if you can determine whether another process is holding an open file handle to the extension.

1 Like

Thanks u sir

Sir, please help me, I'm using the appyBuilder code editor and I can't build Aix.

this is the error

Buildfile: /projects/goldv2/appinventor-sources/appinventor/build.xml

extensions:

clean:

init:

common_CommonUtils:

init:

CommonUtils:

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

CopyToRunLibDir:

components_AndroidRuntime:

init:

CommonConstants:
    [javac] Compiling 6 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning

HtmlEntities:

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

AndroidRuntime:
    [javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/salmanappinventor/ExtensionTemplate/ExtensionTemplate.java:37: error: cannot find symbol
    [javac]       Toast.makeText(YOUR_CONTEXT, value, Toast.LENGTH_SHORT).show();
    [javac]                      ^
    [javac]   symbol:   variable YOUR_CONTEXT
    [javac]   location: class ExtensionTemplate
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.

Total time: 7 seconds
r/components/build/classes/HtmlEntities
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning
      [jar] Building jar: /projects/goldv2/appinventor-sources/appinventor/components/build/HtmlEntities.jar

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

AndroidRuntime:
    [mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/salmanappinventor/ExtensionTemplate/ExtensionTemplate.java:37: error: cannot find symbol
    [javac]       Toast.makeText(YOUR_CONTEXT, value, Toast.LENGTH_SHORT).show();
    [javac]                      ^
    [javac]   symbol:   variable YOUR_CONTEXT
    [javac]   location: class ExtensionTemplate
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.

Total time: 7 seconds

And This is my code :

import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import android.widget.Toast;

//External


@DesignerComponent(version = 1,
    category = ComponentCategory.EXTENSION,
    description = "Made my YOU",
    nonVisible = true,
    iconName = "https://icon-icons.com/icons2/1808/PNG/48/code_115247.png")

@SimpleObject(external = true)

public class ExtensionTemplate extends AndroidNonvisibleComponent {

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

//Write you're code here
   @SimpleFunction(description = "Show toast message")
    public void ShowToastMessage(String value, long time) {
       //YOUR ACTIVITY HERE
      Toast.makeText(YOUR_CONTEXT, value, Toast.LENGTH_SHORT).show();
    }
   

}

Honestly, I dont recommend appybuilder editor. Because it take more than 5 minutes to compile which takes 20 secs like in CMD & Colin Tree Extension builder

so, i have to use what

I have tried to use code from vknow360 and it still raises the error

You need to ask him/developer of the code.

I am confused, what should I do, :pleading_face:

I am also confused every time :sweat_smile: :upside_down_face:

What is "YOUR_CONTEXT" in the code ? You might want to pass the application context there.

The developer from where you got the code wanted to give hint "YOUR_CONTEXT", what to pass as argument.

Here is how to get context

2 Likes

still not work :pleading_face:
but I have added what you said.
Please Help Me :pray:

My Code :

import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import android.widget.Toast;

//External


@DesignerComponent(version = 1,
    category = ComponentCategory.EXTENSION,
    description = "Made my YOU",
    nonVisible = true,
    iconName = "https://icon-icons.com/icons2/1808/PNG/48/code_115247.png")

@SimpleObject(external = true)

public class ExtensionTemplate extends AndroidNonvisibleComponent {

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

//Write you're code here
   @SimpleFunction(description = "Show toast message")
    public void ShowToastMessage(String value) {
       //YOUR ACTIVITY HERE
      Toast.makeText(container.$context(), value, Toast.LENGTH_SHORT).show();
    }
   

}

Error :

Buildfile: /projects/goldv2/appinventor-sources/appinventor/build.xml

extensions:

clean:

init:

common_CommonUtils:

init:

CommonUtils:

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

CopyToRunLibDir:

components_AndroidRuntime:

init:

CommonConstants:
    [javac] Compiling 6 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning

HtmlEntities:
    [javac] Compiling 1 source file to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

AndroidRuntime:
    [javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/salmanappinventor/ExtensionTemplate/ExtensionTemplate.java:37: error: cannot find symbol
    [javac]       Toast.makeText(container.$context(), value, Toast.LENGTH_SHORT).show();
    [javac]                      ^
    [javac]   symbol:   variable container
    [javac]   location: class ExtensionTemplate
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.

Total time: 7 seconds
/HtmlEntities.jar

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

AndroidRuntime:
    [mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/salmanappinventor/ExtensionTemplate/ExtensionTemplate.java:37: error: cannot find symbol
    [javac]       Toast.makeText(container.$context(), value, Toast.LENGTH_SHORT).show();
    [javac]                      ^
    [javac]   symbol:   variable container
    [javac]   location: class ExtensionTemplate
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.

Total time: 7 seconds

I think colin tree builder uses extension templete and appybuilder code editor uses appinventor-sources to compile

Using appinventor-sources is the best if you are unsure that the extension template support. FYI.

Please help me, I think my code is wrong

Define the container variable inside your inner class :point_up: :

private ComponentContainer container;

And then set it to the extension container here, so you can use it any where in your project:

this.container = container;
1 Like

okay i will try, thank you :kissing_heart:

do you mean like this :

import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import android.widget.Toast;

//External


@DesignerComponent(version = 1,
    category = ComponentCategory.EXTENSION,
    description = "Made my YOU",
    nonVisible = true,
    iconName = "https://icon-icons.com/icons2/1808/PNG/48/code_115247.png")

@SimpleObject(external = true)

public class ExtensionTemplate extends AndroidNonvisibleComponent {
  
  private ComponentContainer container; 
  this.container = container;

/*public ExtensionTemplate(ComponentContainer container) {
    super(container.$form());*/
}

//Write you're code here
   @SimpleFunction(description = "Show toast message")
    public void ShowToastMessage(String value) {
       //YOUR ACTIVITY HERE
      Toast.makeText(container.$context(), value, Toast.LENGTH_SHORT).show();
    }
   

}

this.container = container should be in

public (class_name) (...){
super(container.$form());
this.container = container;
}
1 Like

This should be under this line

As the extension container variable is defined there.