My code gives an error java

I was making a really simple test program which asks the user for a permission. Here is my code:

package com.extensions.simpleMath;

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;


@DesignerComponent(version = 1,
        category = ComponentCategory.EXTENSION,
        description = "",
        nonVisible = true,
        iconName = "")

@SimpleObject(external = true)

public class simpleMath extends AndroidNonvisibleComponent {

    public simpleMath(ComponentContainer container) {
        super(container.$form());
    }
    @UsesPermissions(permissionNames = "android.permission.SET_WALLPAPER")
}

The problem is that when I build it, it gives me this error:

Buildfile: C:\Users\Beep\Desktop\Appinventor\extension-template-master\build.xml

javac:
    [javac] Compiling 1 source file to C:\Users\Beep\Desktop\Appinventor\extension-template-master\build\classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] C:\Users\Beep\Desktop\Appinventor\extension-template-master\src\com\extensions\simpleMath\simpleMath.java:34: error: illegal start of type
    [javac] }
    [javac] ^
    [javac] C:\Users\Beep\Desktop\Appinventor\extension-template-master\src\com\extensions\simpleMath\simpleMath.java:34: error: reached end of file while parsing
    [javac] }
    [javac]  ^
    [javac] 2 errors
    [javac] 1 warning

BUILD FAILED
C:\Users\Beep\Desktop\Appinventor\extension-template-master\build.xml:29: Compile failed; see the compiler error output for details.

Total time: 0 seconds

Why is this happening? Thanks.

This goes above the Class not inside it.

This doesn't "ask the user for permission" it just declares them in the manifest.

Okay when I tried to put it above the class, it gave me this error:

Buildfile: C:\Users\Beep\Desktop\Appinventor\extension-template-master\build.xml

javac:
    [javac] Compiling 1 source file to C:\Users\Beep\Desktop\Appinventor\extension-template-master\build\classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] Note: Wrote file file:/C:/Users/Beep/Desktop/Appinventor/extension-template-master/build/classes/simple_components.json
    [javac] Note: Wrote file file:/C:/Users/Beep/Desktop/Appinventor/extension-template-master/build/classes/simple_components.txt
    [javac] Note: Wrote file file:/C:/Users/Beep/Desktop/Appinventor/extension-template-master/build/classes/simple_components_build_info.json
    [javac] Note: Wrote file file:/C:/Users/Beep/Desktop/Appinventor/extension-template-master/build/classes/AutogeneratedOdeMessages.java
    [javac] Note: Wrote file file:/C:/Users/Beep/Desktop/Appinventor/extension-template-master/build/classes/ComponentsTranslation.java
    [javac] C:\Users\Beep\Desktop\Appinventor\extension-template-master\src\com\extensions\simpleMath\simpleMath.java:23: error: cannot find symbol
    [javac] @UsesPermissions(permissionNames = "android.permission.SET_WALLPAPER")
    [javac]  ^
    [javac]   symbol: class UsesPermissions
    [javac] 1 error

BUILD FAILED
C:\Users\Beep\Desktop\Appinventor\extension-template-master\build.xml:29: Compile failed; see the compiler error output for details.

Total time: 1 second

You need to import the class:
import com.google.appinventor.components.annotations.UsesPermissions;

2 Likes