Android的核心库错误 [英] Android core library error

查看:213
本文介绍了Android的核心库错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我包括在JAXP jar文件,我得到的错误如下:

When i am including the jaxp jar file i am getting the error as follows

trouble processing "javax/xml/XMLConstants.class":
[2009-05-08 16:53:18 - TestProject] 
Attempt to include a core VM class in something other than a core library.
It is likely that you have attempted to include the core library from a desktop
virtual machine into an application, which will most assuredly not work. If
you really intend to build a core library -- which is only appropriate as
part of creating a full virtual machine binary, as opposed to compiling an
application -- then use the "--core-library" option to suppress this error
message. If you go ahead and use "--core-library" but are in fact building
an application, then please be aware that your build will still fail at some
point; you will simply be denied the pleasure of reading this helpful error
message.
[2009-05-08 16:53:18 - TestProject] 1 error; aborting
[2009-05-08 16:53:18 - TestProject] Conversion to Dalvik format failed with error 1

时,任何人都面临着这个问题的任何帮助将是非常美联社preciated我已经goend了一些解决方案,但他们没有具体

is anybody has faced this problem any help will be really appreciated i have goend some solution but they are not specific

推荐答案

你的Dx得到的错误是只基于要导入的库而不是其他的Java包名称。

the error you get from Dx is based only on the java package names of the libs you are importing and nothing else.

消息可以概括为:如果您导入了<$​​ C $ C>的Java库* 或的javax * 命名空间,它很可能,这取决于只提供作为JDK的一部分,因此不会在Android平台上提供的其他核心库。它本质上是preventing您从做一些愚蠢的事,当你看到这样的信息是准确的99%的时间。

the message can by summarized as: if you import a library in the java.* or javax.* namespace, it's very likely that it depends on other "core" libraries that are only provided as part of the JDK, and therefore won't be available in the Android platform. it's essentially preventing you from doing something stupid, which is accurate 99% of the time when you see that message.

现在,当然,仅仅因为一个java包开始的java。* 的javax。* 不一定意味着它依赖于JDK正确的。它可以完全正常工作的机器人。绕过愚蠢检查,添加--core库选择DX。修改 $ ANDROID_HOME /平台工具/ DX的最后一行

now, of course, just because a java package starts with java.* or javax.* does not necessarily mean that it depends on the JDK proper. it may work perfectly fine in android. to get around the stupidity check, add the --core-library option to dx. change the last line of $ANDROID_HOME/platform-tools/dx from,

exec java $javaOpts -jar "$jarpath" "$@"

exec java $javaOpts -jar "$jarpath" --core-library "$@"

在我的情况,我是包括依靠杰克逊,这取决于JAXB库。对我来说,压倒一切的愚蠢检查是可以接受的,因为图书馆的使用杰克逊的仅是为JSON而不是XML序列化(我只包括JAXB API库,而不是implement执行)。当然,我希望有一个更清洁的方式来进行此事,但重写顶级库,以避免使用杰克逊是不是一种选择。

in my case, i was including a library that depended on Jackson, which depends on JAXB. for me, overriding the stupidity check was acceptable because the library's use of Jackson was only for JSON and not for XML serialization (i only include the JAXB API library, not the impl). of course i wish there was a cleaner way to go about this, but re-writing the top level library to avoid using Jackson was not an option.

这篇关于Android的核心库错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆