Muhammad Umar
Muhammad Umar

Reputation: 11782

Using java jdk in android java.awt

I am trying to use java.awt.polygon class in android programming. In Java build paths, I have added

Jave JRE System library jdk 1.7

.

However while using this piece of code

java.awt.Polygon polyGon = new Polygon();

i get error NoClassDefFoundError. How can I use java class in android?

Upvotes: 0

Views: 662

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006574

I am trying to use java.awt.polygon class in android programming

That is not possible, as that class does not exist in Android.

In Java build paths, I have added Jave JRE System library jdk 1.7

That will not work, as that class does not exist in Android. While you have added it to your build path, it is not included in the APK and is not in the operating system.

How can I use java class in android?

Find the source for the class, refactor it into your own package (e.g., org.umar.Polygon), and add it to your project, then use your refactored version. Along the way, please respect the license for the class (e.g., GPL if you are using OpenJDK).

Upvotes: 2

Related Questions