简体   繁体   English

在android java.awt中使用java jdk

[英]Using java jdk in android java.awt

I am trying to use java.awt.polygon class in android programming. 我想在android编程中使用java.awt.polygon类。 In Java build paths, I have added 在Java构建路径中,我添加了

Jave JRE System library jdk 1.7 Jave JRE系统库jdk 1.7

.

However while using this piece of code 但是在使用这段代码时

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

i get error NoClassDefFoundError . 我得到错误NoClassDefFoundError How can I use java class in android? 我怎样才能在android中使用java类?

I am trying to use java.awt.polygon class in android programming 我想在android编程中使用java.awt.polygon类

That is not possible, as that class does not exist in Android. 这是不可能的,因为Android中不存在该类。

In Java build paths, I have added Jave JRE System library jdk 1.7 在Java构建路径中,我添加了Jave JRE System库jdk 1.7

That will not work, as that class does not exist in Android. 这不起作用,因为Android中不存在该类。 While you have added it to your build path, it is not included in the APK and is not in the operating system. 虽然您已将其添加到构建路径中,但它不包含在APK中且不在操作系统中。

How can I use java class in android? 我怎样才能在android中使用java类?

Find the source for the class, refactor it into your own package (eg, org.umar.Polygon ), and add it to your project, then use your refactored version. 找到该类的源代码,将其重构到您自己的包中(例如, org.umar.Polygon ),并将其添加到您的项目中,然后使用您的重构版本。 Along the way, please respect the license for the class (eg, GPL if you are using OpenJDK). 在此过程中,请尊重该类的许可(例如,如果您使用OpenJDK,则为GPL)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM