- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
所以我正在转换为 Retrofit 2.0。但是,当我尝试将简单 XML 转换器添加到我的 build.gradle 时,它将不再编译。
这是我的依赖
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
compile 'com.squareup.retrofit:converter-simplexml:2.0.0-beta2' //THIS LINE
compile 'com.google.code.gson:gson:2.3'
compile 'org.parceler:parceler:0.2.13'
compile 'com.jakewharton:butterknife:7.0.1'
}
当我去编译我的代码时,我得到了以下错误:
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.
这个错误对社区来说并不是什么新鲜事,我只是不明白它如何适用于我的项目。我什至还没有写任何代码,我无法编译我的基本依赖项。如果我注释掉这一行
compile 'com.squareup.retrofit:converter-simplexml:2.0.0-beta2'
代码编译。所以这绝对是某种方式的罪魁祸首。
最佳答案
我修好了。显然你必须排除一些东西。
compile ('com.squareup.retrofit:converter-simplexml:2.0.0-beta2') {
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}
希望这对其他人有帮助
关于android - 错误编译 com.squareup.retrofit :converter-simplexml:2. 0.0-beta2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34049934/
这里发生了什么事? $string = XML; $xml = simplexml_load_string($string); // $xmlobj = sim
当我将 SimpleXML 解析为对象数组的一部分的字符串时,我一直坚持让 SimpleXML 返回一个对象。 $a = '1145869290false43false'; $resultA = si
我有两个 SimpleXML 对象。如何将一个对象添加为另一个对象的子元素。 请注意,这不能通过 addChild 方法完成,因为它会在添加之前将给定值转换为字符串。 最佳答案 我发现 SimpleX
http://pastie.org/1701923这是从我查询邮政编码的 API 返回的 XML。 我想从每个条目中提取数据,然后直接对其进行循环或将其放入我可以循环的数组中。我似乎无法正确处理。这是
这个问题在这里已经有了答案: remove xml version tag when a xml is created in php (10 个答案) 关闭 7 年前。 我使用 SimpleXML
与 DOM 或 Expat 解析器相比,SimpleXML 仅仅用几行代码就可以从 XML 元素中读取文本数据。 SimpleXML 可把 XML 文档(或 XML 字符串)转换为对象,比如:
我有一些看起来像这样的 XML: true 42 ;jsessionid=42 SimpleXML 以这种方式解析它: $obj
我有一个具有命名空间属性的 XML 文档。 XML 看起来像: 我如何提取 and
我想从元素id的属性创建一个数组,但是以下代码返回所有XML。 PHP文件: $xmlfile=simplexml_load_file("test.xml"); $test=$xmlfile->xpa
我有一个看起来像这样的XML结构: 0 Some survey question Answer 1 0 Answ
我正在尝试访问具有命名空间声明的节点中没有命名空间声明的节点列表。我的 XML 文件有一个带有命名空间 ehd 的主节点,在同一命名空间内有两个子节点 header、body。但是,主体节点内的所有子
我正在使用 SimpleXML 和 XPath 尝试获取子节点('IndexEntry)属性('indexKey')的值。节点的命名空间,我已在另一个节点(“记录”)上成功测试。由于某种原因,该节点的
我有两棵 XML 树,想将一棵树作为叶子添加到另一棵树上。 显然: $tree2->addChild('leaf', $tree1); 不起作用,因为它仅复制第一个根节点。 好吧,所以我想我应该遍历整
我正在使用 SimpleXML http://simple.sourceforge.net/home.php 在我的 Android 应用程序中, 我从 API 获取数据如下:
我想使用 SimpleXML 读取并解析包含员工信息的 XML 文件。框架。这是我的 XML 文件: 29 Pankaj
我正在尝试在 android 中使用 simplexml 解析此 xml 字符串: " " 是的,我知道门标签应该立即关闭,而不是在声明所有门标签后关闭,我无法控制这个
我有一个具有这种结构的 XML 文件:
请,我需要解析包含汽车信息的 XML 文件。我在汽车、照片中完成了所有操作,但我需要在额外的表中包含 id、汽车表 id 的外键,并且所有汽车都有随机的 Equipment_id。 我需要将其放入“设
我有一个看起来像这样的 xml: 在 xml 映射 java 代码中我有这样的东西: public class A { @Element(required=false)
我有一个xml文档如下: Calculations Description First Description Alan
我是一名优秀的程序员,十分优秀!