Help me making this simple calculation in my extension

@luv.ak.tech can you share the error? That only tells me that the build failed.

1 Like

ok i will share

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/contact2niraj/Maths_extension/Maths_extension.java:58: error: cannot find symbol
[javac] public int LoopOverList(YailList list) {
[javac] ^
[javac] symbol: class YailList
[javac] location: class Maths_extension
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/contact2niraj/Maths_extension/Maths_extension.java:75: error: cannot find symbol
[javac] public int LoopOverList(YailList list) {
[javac] ^
[javac] symbol: class YailList
[javac] location: class Maths_extension
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/contact2niraj/Maths_extension/Maths_extension.java:62: error: incompatible types: Object cannot be converted to String
[javac] for (String itemInList : listOfNumbers) {
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/contact2niraj/Maths_extension/Maths_extension.java:79: error: incompatible types: Object cannot be converted to String
[javac] for (String itemInList : listOfNumbers) {
[javac] ^
[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] 4 errors
[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
lList list) {
[javac] ^
[javac] symbol: class YailList
[javac] location: class Maths_extension
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/contact2niraj/Maths_extension/Maths_extension.java:75: error: cannot find symbol
[javac] public int LoopOverList(YailList list) {
[javac] ^
[javac] symbol: class YailList
[javac] location: class Maths_extension
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/contact2niraj/Maths_extension/Maths_extension.java:62: error: incompatible types: Object cannot be converted to String
[javac] for (String itemInList : listOfNumbers) {
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/contact2niraj/Maths_extension/Maths_extension.java:79: error: incompatible types: Object cannot be converted to String
[javac] for (String itemInList : listOfNumbers) {
[javac] ^
[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] 4 errors
[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

Do you have import com.google.appinventor.components.runtime.util.YailList;?

sorry i forgot to add that

1 Like

After you add the class, make sure the function looks like that.

1 Like

it looks like this

Are you ok?

Oop, they went offline :face_with_hand_over_mouth:

its still showing error

Could you show your code?Are you really sure that you haven’t use an old version of @hammerhai’s code:

1 Like

no i used the new code

i will just download again

see this error what i got from new code
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/contact2niraj/Maths_extension/Maths_extension.java:63: error: incompatible types: Object cannot be converted to String
[javac] for (String itemInList : listOfNumbers) {
[javac] ^
[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
[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/contact2niraj/Maths_extension/Maths_extension.java:63: error: incompatible types: Object cannot be converted to String
[javac] for (String itemInList : listOfNumbers) {
[javac] ^
[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

What about your code?

i cant message you please message me

please someone help me

this is my code please tell

/**  ~~~~~
 * Created with the AppyBuilder Code Editor.
 * This is a template for basic Extension.
 * Modify this template to customize your extension.
 *
 * **** NOTE: DO NOT use a package name. 
 * **** The package name will be created for you automatically.
 * **** Adding a package name will cause a compile error
 */
import android.content.Context;
import android.util.Log;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.*;
import com.google.appinventor.components.common.ComponentCategory;
import java.lang.NumberFormatException;
import java.util.Arrays;
import java.util.List;
import com.google.appinventor.components.runtime.util.YailList;

@DesignerComponent(version = 1,  description = "This extension is to do some basic and advance calculations" + 
                   "Create your own here:<br><a href='https://editor.appybuilder.com' target='_blank'>https://editor.appybuilder.com</a><br>",
        category = ComponentCategory.EXTENSION,
        nonVisible = true,   iconName = "http://appyBuilder.com/extensions/icons/extension.png")
@SimpleObject(external = true)
public class Maths_extension extends AndroidNonvisibleComponent {
    private ComponentContainer container;
    /**
     * @param container container, component will be placed in
     */
    public Maths_extension(ComponentContainer container) {
        super(container.$form());
        this.container = container;
    }
  
    @SimpleFunction(description = "Number 1 + Number 2")
    public int Add (int Number1, int Number2) 
    {
        return Number1 + Number2; }
    
   @SimpleFunction(description = "Number 1 - Number 2")
    public int Substract (int Number1, int Number2) 
    {
        return Number1 + Number2; }
    
   @SimpleFunction(description = "Number 1 × Number 2")
    public int Multiply (int Number1, int Number2) 
    {
        return Number1 * Number2; }
  
  @SimpleFunction(description = "Number 1 ÷ Number 2")
    public int Divide (int Number1, int Number2) 
    {
        return Number1 / Number2; }
 
@SimpleFunction
public int LoopOverList(YailList list) {
  List listOfNumbers = Arrays.asList(list.toStringArray());
  int finalResult = 0;

  for (String itemInList : listOfNumbers) {
    try {
      finalResult += Integer.parseInt(itemInList);
    } catch(NumberFormatException nfe) {
      // Not a number
      nfe.printStackTrace();
    }
  }

  return finalResult;
}
}

please tell what i am doing wrong

This post was flagged by the community and is temporarily hidden.

Stop spamming the community. If someone wants to help you they will. Don’t keep posting to get attention. You will get suspended if you continue.

3 Likes