【问题标题】:Robospice/Maven Intellij AndroidRobospice/Maven Intellij Android
【发布时间】:2014-06-10 14:10:26
【问题描述】:

我正在尝试使用 Robospice for Android。

在 IntelliJ 中,我创建了一个空白的 Android 项目。 然后我去了文件->项目结构->库 从 Maven 单击 +。 然后找到最新版本的 Robospice 并导入。

完成此操作后,我的 Android 项目现在无法构建。 我收到以下错误消息:

Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] trouble processing "javax/xml/parsers/DocumentBuilder.class":
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] Ill-advised or mistaken usage of a core class (java.* or javax.*)
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] when not building a core library.
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] This is often due to inadvertently including a core library file
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] in your application's project, when using an IDE (such as
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] Eclipse). If you are sure you're not intentionally defining a
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] core class, then this is the most likely explanation of what's
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] going on.
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] However, you might actually be trying to define a class in a core
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] namespace, the source of which you may have taken, for example,
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] from a non-Android virtual machine project. This will most
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] assuredly not work. At a minimum, it jeopardizes the
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] compatibility of your app with future versions of the platform.
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] It is also often of questionable legality.
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] If you really intend to build a core library -- which is only
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] appropriate as part of creating a full virtual machine
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] distribution, as opposed to compiling an application -- then use
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] the "--core-library" option to suppress this error message.
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] If you go ahead and use "--core-library" but are in fact
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] building an application, then be forewarned that your application
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] will still fail to build or run, at some point. Please be
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] prepared for angry customers who find, for example, that your
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] application ceases to function once they upgrade their operating
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] system. You will be to blame for this problem.
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] If you are legitimately using some code that happens to be in a
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] core package, then the easiest safe alternative you have is to
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] repackage that code. That is, move the classes in question into
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] your own package namespace. This means that they will never be in
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] conflict with core system classes. JarJar is a tool that may help
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] you in this endeavor. If you find that you cannot do this, then
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] that is an indication that the path you are on will ultimately
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] lead to pain, suffering, grief, and lamentation.
Error:Android Pre Dex: [xmlParserAPIs-2.6.2.jar] 1 error; aborting

我不确定我哪里出错了?!

【问题讨论】:

    标签: maven intellij-idea android-library robospice


    【解决方案1】:

    正如所指出的,您需要排除一些库,方法如下

    当您从 maven 添加库(而不是使用 maven 构建项目)时,Intellij IDEA 或 Android Studio 会为其带来传递依赖。

    使用机器人 v5.2.1。您需要删除以下内容:

    com.google.android:android
    xpp3:xpp3
    org.apache.httpcomponents:httpclient
    junit:junit
    xerces:xmlParserApi
    

    选择机器人作为库或已经从文件 - >项目结构中选择 - > libraries

    如果您使用的是 maven,请参阅此其他帖子 Cannot "Make Project" Android Maven on Android Studio 0.2.5

    【讨论】:

      【解决方案2】:

      阅读wiki pages 中关于 RS 的设置,您会看到一些扩展在 Android 上需要一些排除。这与 RoboSpice 无关,但取决于库本身(例如 XMLParser 依赖于 Android 上必须排除的 stax 和 xp3)。

      【讨论】:

        猜你喜欢
        • 2013-03-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-18
        • 2016-02-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多