我有绝对空的Android项目生成

mvn archetype:generate -DarchetypeArtifactId=android-quickstart .......

它构建良好,部署合理,运行良好.问题是,当我添加

org.simpleframework

simple-xml

2.6.2

依赖,构建失败,

[INFO] --- android-maven-plugin:3.0.0:dex (default-dex) @ whoops-android-app1 ---

[INFO] C:\Program Files\Java\jdk1.7.0\jre\bin\java [-jar, D:\android-sdk\platform-tools\lib\dx.jar, --dex, --output=D:\whoops\xxx\whoops-android-app1\target\classes.dex, C:\Users\loki2302\.m2\repository\xpp3\xpp3\1.1.4c\xpp3-1.1.4c.jar, C:\Users\loki2302\.m2\repository\org\simpleframework\simple-xml\2.6.2\simple-xml-2.6.2.jar, C:\Users\loki2302\.m2\repository\stax\stax\1.2.0\stax-1.2.0.jar, C:\Users\loki2302\.m2\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar, D:\whoops\xxx\whoops-android-app1\target\classes]

[INFO]

[INFO] trouble processing "javax/xml/namespace/QName.class":

[INFO]

[INFO] Ill-advised or mistaken usage of a core class (java.* or javax.*)

[INFO] when not building a core library.

[INFO]

[INFO] This is often due to inadvertently including a core library file

[INFO] in your application's project, when using an IDE (such as

[INFO] Eclipse). If you are sure you're not intentionally defining a

[INFO] core class, then this is the most likely explanation of what's

[INFO] going on.

[INFO]

[INFO] However, you might actually be trying to define a class in a core

[INFO] namespace, the source of which you may have taken, for example,

[INFO] from a non-Android virtual machine project. This will most

[INFO] assuredly not work. At a minimum, it jeopardizes the

[INFO] compatibility of your app with future versions of the platform.

[INFO] It is also often of questionable legality.

[INFO]

[INFO] If you really intend to build a core library -- which is only

[INFO] appropriate as part of creating a full virtual machine

[INFO] distribution, as opposed to compiling an application -- then use

[INFO] the "--core-library" option to suppress this error message.

[INFO]

[INFO] If you go ahead and use "--core-library" but are in fact

[INFO] building an application, then be forewarned that your application

[INFO] will still fail to build or run, at some point. Please be

[INFO] prepared for angry customers who find, for example, that your

[INFO] application ceases to function once they upgrade their operating

[INFO] system. You will be to blame for this problem.

[INFO]

[INFO] If you are legitimately using some code that happens to be in a

[INFO] core package, then the easiest safe alternative you have is to

[INFO] repackage that code. That is, move the classes in question into

[INFO] your own package namespace. This means that they will never be in

[INFO] conflict with core system classes. JarJar is a tool that may help

[INFO] you in this endeavor. If you find that you cannot do this, then

[INFO] that is an indication that the path you are on will ultimately

[INFO] lead to pain, suffering, grief, and lamentation.

[INFO]

[INFO] 1 error; aborting

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 2.711s

[INFO] Finished at: Tue Dec 13 12:31:23 MSK 2011

[INFO] Final Memory: 18M/178M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.0.0:dex (default-dex) on project whoops-android-app1: MojoExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0\jre\bin\java" -jar D:\android-sdk\platform-tools\lib\dx.jar --dex --output=D:\whoops\xxx\whoops-android-app1\target\classes.dex C:\Users\loki2302\.m2\repository\xpp3\xpp3\1.1.4c\xpp3-1.1.4c.jar C:\Users\loki2302\.m2\repository\org\simpleframework\simple-xml\2.6.2\simple-xml-2.6.2.jar C:\Users\loki2302\.m2\repository\stax\stax\1.2.0\stax-1.2.0.jar C:\Users\loki2302\.m2\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar D:\whoops\xxx\whoops-android-app1\target\classes", Result = 1 -> [Help 1]

删除此依赖关系可修复构建.这是我的mvn –version:

Apache Maven 3.0.3 (r1075438; 2011-02-28 20:31:09+0300)

Maven home: D:\apache-maven-3.0.3\bin\..

Java version: 1.7.0, vendor: Oracle Corporation

Java home: C:\Program Files\Java\jdk1.7.0\jre

Default locale: en_US, platform encoding: Cp1251

OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

这是我的pom.xml:

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

4.0.0

com.whoops.android

whoops-android-app1

1.0-SNAPSHOT

apk

whoops-android-app1

com.google.android

android

2.1.2

provided

org.simpleframework

simple-xml

2.6.2

com.jayway.maven.plugins.android.generation2

android-maven-plugin

3.0.0

${project.basedir}/AndroidManifest.xml

${project.basedir}/assets

${project.basedir}/res

${project.basedir}/src/main/native

7

true

true

true

maven-compiler-plugin

2.3.2

1.6

1.6

之前尝试过Maven 2和Maven-android-plugin 2. *-结果是相同的.仅对simple-xml依赖项失败.在禁用simple-xml的情况下启用codegist-crest效果很好.仅当我使用simple-xml时才会发生这种情况.

我还尝试了在没有maven(Eclipse)的情况下进行同样的操作-在这种情况下,即使我的构建路径上具有simple-xml,一切都可以正常工作.

有任何想法吗?

解决方法:

这里的问题是simple-xml或更可能是其依赖项之一已经在保留的java.*或javax.*名称空间中定义了一个或多个类.在Android平台上不允许这样做.虽然,我不确定为什么这会在Eclipse中起作用.该库是否可能在构建路径上,但未包含在最终编译的APK中?

由于Android平台提供了许多与XML相关的软件包,因此您可能不需要simple-xml:

更新:

标签:maven,android

来源: https://codeday.me/bug/20191101/1987261.html

android simple-xml,使用Maven构建Android项目-dexer在simple-xml依赖项上失败相关推荐

  1. IntelliJ 使用Maven构建Android项目过程

    这是我的第一篇博客!对我的意义十分重大!在这篇博客的编写过程就是我在使用Maven构建Android项目中踩过的坑的记录.在此由于本人的水平有限,这篇文章也只能当作经验借鉴而已,希望后来者能够避开这些 ...

  2. maven(3)------maven构建web项目详细步骤

    eclipse集成工具,轻松通过maven构建web项目步骤如下: 一, 右键,new -->project, 进入下一页面 二,选择"Maven Project", 点击下 ...

  3. 转】用Maven构建Mahout项目

    原博文出自于: http://blog.fens.me/hadoop-mahout-maven-eclipse/ 感谢! 用Maven构建Mahout项目 Hadoop家族系列文章,主要介绍Hadoo ...

  4. 用Maven构建Mahout项目

    Hadoop家族系列文章,主要介绍Hadoop家族产品,常用的项目包括Hadoop, Hive, Pig, HBase, Sqoop, Mahout, Zookeeper, Avro, Ambari, ...

  5. Maven构建java项目

    本篇文章,我们会教你如何用maven创建一个java项目,学会如何导入到eclipse中,将该java项目打包成一个jar文件并成功执行. 关于maven:它是apache基金会推出的一个项目管理工具 ...

  6. maven 构建java项目,jdk版本问题

    为什么80%的码农都做不了架构师?>>>    使用maven构建Java项目,默认的 jdk 版本是1.5 详情见官方说明:https://maven.apache.org/plu ...

  7. 使用Maven构建Java项目

    使用Maven构建Java项目 本指南将引导您使用Maven构建一个简单的Java项目. 你会建立什么 您将创建一个提供一天中时间的应用程序,然后使用Maven进行构建. 你需要什么 约15分钟 最喜 ...

  8. 转】用Maven构建Hadoop项目

    原博文出自于: http://blog.fens.me/hadoop-maven-eclipse/ 感谢! 用Maven构建Hadoop项目 Hadoop家族系列文章,主要介绍Hadoop家族产品,常 ...

  9. 设置maven 参数调休_IDEA 使用 Maven构建Spark项目

    上一篇讲了普通构建spark项目 这次分享用Maven构建Spark项目,中间遇到了很多坑!其根本原因是Scala 与 Spark的版本不一致! 本次环境: Java1.8 Scala 2.11.8 ...

最新文章

  1. CSS 详细解读定位属性 position 以及参数
  2. 手写自己的MyBatis框架-1.0 的不足
  3. chrome不认documentElement.scrollTop
  4. (十一)nodejs循序渐进-高性能游戏服务器框架pomelo之启动流程和组件
  5. 游戏角色坐标的保存间隔_游戏岗位看这里鸭——
  6. linux系统给串口权限,让ubuntu串口和USB设备不用root权限访问
  7. [转载] plt.hist()和numpy.histogram()的学习
  8. 自适应中值滤波器(基于OpenCV实现)
  9. 切比雪夫多项式(Chebyshev Polynomials)
  10. python 手机App数据抓取实战一
  11. CSDN/博客园复制代码空格报错问题解决
  12. 用大数据看懂《速度与激情》的用车法则
  13. 【杂谈】嵌入式软件数据结构的特点
  14. python区间中的数字统计
  15. 如何用计算机表达无理数,科学网—刘瑞祥:计算机表示无理数的一些设想 - 孙冰的博文...
  16. ios9遇到 App Transport Security has blocked a cleartext HTTP(http://) resource load 错误
  17. 进入外包公司之后…………
  18. (CVPR-2021)RepVGG:极简架构,SOTA性能,让VGG式模型再次伟大
  19. android 粒子爆炸特效
  20. TCL智能电视ROOT教程 附ROOT工具下载

热门文章

  1. BZOJ 2836 树链剖分+线段树
  2. android内核中Kconfig及如何加自己的驱动
  3. Comparable与Comparator异同
  4. 使用XML及XSL生成简单HTML
  5. 剑指offer(C++)-JZ76:删除链表中重复的结点(数据结构-链表)
  6. android studio maven gradle,Maven Dependencies with Android Studio / Gradle
  7. 接口测试——Fiddler使用要点——笔记整理
  8. python提取日志内容_Python正则提取日志内容
  9. python如何制作一个工程软件_如何利用python制作一个解压缩软件-Go语言中文社区...
  10. java面试会问到的问题吗_[转载]java面试中经常会被问到的一些算法的问题