java.awt classes in libGDX

I am working on a game application, which uses java.awt classes, just like java.awt.point. It is no problem if I compile to desktop, but it causes error messages under android.

Not found...

How can I import or use these classes? These are very important for the proper functionality of this application.
I have found a project(An attempt to facilitate AWT rendering on the Android platform), but it is now closed and all the files have been deleted, I think: https://code.google.com/p/awt-android-compat/

What classes are you using? Simple ones like Point are trivial to implement yourself, or better yet, use the libGDX versions: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Vector2.html

Don’t try to use AWT on Android, and it has no place in your project if you are using libGDX.

BurntPizza is right. You shouldn’t use AWT from the very beginning of a project when you plan to target Android which uses a subset of J2SE in Dalvik VM and ART.

It is a “ported” native Java program, that is why I am using these classes.

I use these from AWT:

import java.awt.Point;
import java.awt.Rectangle;

If there are only this two classes, it shouldn’t be hard to replace them.
Libgdx does also have a Rectangle class and the Point class is simmilar to the Vector2 class.
I guess thats the better solution.

When I try to import it, I get the following error: [quote]The import com.badlogic.gdx.math.Rectangle collides with another import statement
[/quote]

That is because you allready import the java.awt.Rectangle.
So you have 2 different classes, with the same name.
If you now create a new Rectangle, who knows if it is a java.awt.Rectangle or a com.badlogic.gdx.math.Rectangle?
As you are replacing the java.awt.Rectangle you can simply remove this import.
I guess you will get a few errors, so you allready know where you need to replace the awt.Rectangle with the Libgdx Rectangle.

In other cases, where you need 2 classes with the same name, you can import only 1 and define the other by using its full name.
For example:


import java.awt.Rectangle;

public class Test {

    private Rectangle r;    // java.awt.Rectangle
    private com.badlogic.gdx.math.Rectangle r2;    // com.badlogic.gdx.math.Rectangle
}