java - 故障处理 "javax/xml/XMLConstants.class"

标签 java android

我正在开始一个新的 Android 项目。该项目引用了一个第三方 JAR,该 JAR 又引用了另外 4 个 jar:

ws-commons-java5-1.0.1.jar
ws-commons-util-1.0.2.jar
xmlrpc-client-3.1.3.jar
xmlrpc-common-3.1.3.jar

据我所知,我认为这 4 个 jar 是我认为的标准 Java 类。无论如何,我的构建路径中有所有这五个 jar (上面的 4 个 + 1 个第三方 jar )。当我尝试运行我的 Android 应用程序时,我得到:

Dx 
trouble processing "javax/xml/XMLConstants.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.

However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. 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.

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.

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.

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. JarJar is a tool that may help
you in this endeavor. 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.

[2012-03-21 23:05:05 - MyApp ] Dx 1 error; aborting
[2012-03-21 23:05:05 - MyApp ] Conversion to Dalvik format failed with error 1

我不确定在这里做什么。这就像它在问我是否正在尝试构建一个核心库,我不是。我只是想在我的项目中使用这些 JAR。我应该在我的项目中引用这些 JAR 的另一种方式吗?该错误听起来好像我的项目有一天会随机停止为某人工作。

这一切都非常令人困惑。关于如何正确进行的任何线索?

最佳答案

SO 上有一些类似的问题报告(与其他类但消息类型相同)并隐藏在对 closed question 的评论中我在外部站点上找到了指向解决方案的指针:

Ill-advised or mistaken usage of a core class

关于java - 故障处理 "javax/xml/XMLConstants.class",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9816768/

相关文章:

java - Docker 在类路径上找不到资源

java - liferay-ui :input-move-boxes get List from action

Java正则表达式否定前瞻错误匹配

java - 跳过可选的 bean 引用属性

android - Google map 交互式折线的 API 级别?

android - 关于泛型导致 ClassCastException LinkedTreeMap 无法转换为 Any

java - 将 retrofit 回调值转换为返回封装对象

java - 如何抑制 Selenium 日志

android - 将 iOS 应用程序移植到 Android

java - 从 android 中的 ArrayList<HashMap<String, String>> 获取奇数或偶数值