尝试包括核心类(Java。*或使用javax。*)的东西比一个核心库等核心、东西、Java、javax

2023-09-06 02:03:23 作者:我本流氓无限嚣张

我是新的Andr​​oid。我是通采样工作和运行HelloGridView应用程序时,有一个错误。日食是给下面的错误。有没有人有下列错误?谢谢你。

Hi i'm new android. i'm working through the samples and have an error when running the HelloGridView app. Eclipse is giving the following error. Has anyone had the following error? Thanks.

[2010-12-06十四时38分16秒 - HelloGridView] 故障处理的javax / NET / ServerSocketFactory.class: [2010-12-06 14点38分十六秒 - HelloGridView] 尝试包括核心类(Java。*或使用javax。*)的一些其他 比核心库。很可能你已经尝试包括 在从桌面应用程序的核心库(或其部分) 虚拟机。这将最稳妥无法正常工作。至少,它 危害您的应用程序与未来版本的兼容性 平台。这是值得商榷的合法性也经常。

[2010-12-06 14:38:16 - HelloGridView] trouble processing "javax/net/ServerSocketFactory.class": [2010-12-06 14:38:16 - HelloGridView] Attempt to include a core class (java.* or javax.*) in something other than a core library. It is likely that you have attempted to include in an application the core library (or a part thereof) from a desktop virtual machine. This will most assuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform. It is also often of questionable legality.

如果你真的打算建立一个核心库 - 这是唯一 合适的,创建一个完整的虚拟机分配的一部分, 而不是编译应用程序 - 然后使用 --core库选项晚饭preSS此错误消息。

If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message.

如果您继续使用--core库,但实际上建设 应用程序,然后谅解,您的应用程序仍然会失败 建设或运行,在某些时候。请ppared为愤怒的客户$ P $ 谁找到,例如,您的应用程序停止运行一次 他们升级操作系统。你会责怪这个 问题。

If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem.

如果您是合法使用一些code恰好是在核心 包,那么最简单安全的替代你已经是重新打包 这code。也就是说,移动类的问题到你自己的包 命名空间。这意味着他们将永远不会与核心冲突 系统类。如果你发现你不能做到这一点,那么这是一个 迹象表明,你是上的路径将最终导致疼痛, 痛苦,悲伤和悔恨。

If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question into your own package namespace. This means that they will never be in conflict with core system classes. If you find that you cannot do this, then that is an indication that the path you are on will ultimately lead to pain, suffering, grief, and lamentation.

[2010-12-06十四时38分16秒 - HelloGridView] 1错误;中止 [2010-12-06 14点38分十六秒 - HelloGridView]转换为的Dalvik格式失败,出现错误1

[2010-12-06 14:38:16 - HelloGridView] 1 error; aborting [2010-12-06 14:38:16 - HelloGridView] Conversion to Dalvik format failed with error 1

推荐答案

Android框架不允许在项目外部罐子除了Java核心类库。

Android framework do not allow addition of JAVA core libraries in your project as external jars.

继承人如何库添加到应用程序:

Heres how you can add libraries to your application:

右键单击项目打开项目属性,然后选择属性 在左窗格中选择Java Build Path 从右侧的选择库标签 单击Add Library按钮 选择JRE系统库,并添加所需的软件包。