Failed resolution of: Ljava/awt/ Rectangle

Hi i'm making my first extension and do not know what module to import.
After compile without error, when using it in app i got: Failed resolution of: Ljava/awt/ Rectangle;

It's look like the problem is coming from all java.awt module.

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 android.app.Activity;
import android.os.Environment;
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.*;
import java.io.File;
import java.io.FileOutputStream;

import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import javax.imageio.ImageIO;
import org.apache.commons.codec.binary.Base64;

thanks!

Hi @Zod Welcome
Since android uses different graphics library(android.graphics) so you can't use the java.awt classes.
You should use android.graphics.Rect instead.

Thank you for the replay.
i'm trying to make the change on this code:

Rectangle screenSize = new 
Rectangle (Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage screenCapture = null;
screenCapture = new Robot().createScreenCapture(screenSize);

i got this:

int x = 50;
int y = 50;
int sideLength = 200;
Rect screenSize = new Rect(x, y, sideLength, sideLength);
//Rect screenSize = new 
//Rect(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage screenCapture = null;
screenCapture = new Robot().createScreenCapture(screenSize);  // error here

but screenSize look not same here, on the last line i got error: error: incompatible types: Rect cannot be converted to Rectangle

Somewhere in your code, Rectange is needed but you are passing Rect.
Both are not same.

try
screenCapture = new Robot().createScreenCapture((Rectangle)screenSize);