What is wrong in my code

What is wrong in my code
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:
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/build/components
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build
[mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes
[
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/farazfiroz2472/CustomCardView/CustomCardView.java:53: error: expected
[javac] cv.setOnClickListener(){
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/farazfiroz2472/CustomCardView/CustomCardView.java:56: error: ';' expected
[javac] public void OnClick(Object id);{
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/farazfiroz2472/CustomCardView/CustomCardView.java:56: error: ';' expected
[javac] public void OnClick(Object id);{
[javac] ^
[javac] 3 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: 3 seconds
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/farazfiroz2472/CustomCardView/CustomCardView.java:56: error: ';' expected
[javac] public void OnClick(Object id);{
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/farazfiroz2472/CustomCardView/CustomCardView.java:56: error: ';' expected
[javac] public void OnClick(Object id);{
[javac] ^
[javac] 3 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: 2 seconds

My code
`/** ~~~~~

  • 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 y670name 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 com.google.appinventor.component.runtime.HVArrangement;

@DesignerComponent(version = 1, description = "This Extension was created with the AppyBuilder Code Editor.
" +
"Create your own here:
https://editor.appybuilder.com
",
category = ComponentCategory.EXTENSION,
nonVisible = true, iconName = "http://appyBuilder.com/extensions/icons/extension.png")
@SimpleObject(external = true)
public class CustomCardView extends AndroidNonvisibleComponent {
private ComponentContainer container;
/**
* @param container container, component will be placed in
*/
public CustomCardView(ComponentContainer container) {
super(container.$form());
this.container = container;
}
@SimpleFunction
public void CreateCard(HVArrangement layout, Object Id, int radius, int padding, Color bgColor, int elevation) {
CustomCardView fl = new FrameLayout(layout);
CustomCardView cv = new CardView();
fl.add(cv);
cv.setId(id);
cv.setRadius(radius) ;
cv.setPadding(padding);
cv.setCardBackgroundColor(bgColor);
cv.setMaxCardElevation(elevation);
}

@SimpleFunction
public void AddComponent(AndroidViewComponent component);{
cv.add(component);

}

cv.setOnClickListener(){
  @SimpleEvent

public void OnClick(Object id);{
EventDispatcher.dispatchEvent(this, "OnClick", id);

id = cv.get(position).getId() ;
}
}
}`

Please help me

where do you think your card view class is?

Ah...a lot of errors.
You should learn Java first.

I want a java tutorial

Solution is import these too :

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.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;

@Faraz_Firoz This is the java tutorial you are looking for...

But this language is not working in appybuilder

So, first you import the following that I said and try to build the .aix, then reply to this post or PM me.

its java only if you just copy the whole code and paste it that will not work :wink:

1 Like

Wrong?
It is fine only

Can you please explain how is it fine ?

2 Likes

@R.K_Abhijith my whole code is wrong. My code is upto 75% wrong

1 Like

there are many typos in your code i guess.

Can you tell me some wrong code

you have missed typing commas as i see in the above in line 56

Can you give me some more error

follow the directory and get to line 56 and then add a comma in a place where it is supposed to be

I done this

Online Java Debugger - online editor (onlinegdb.com)

paste your code there and debug it
are you using notepad++:question::expressionless::expressionless: