我有一个带有intellij的Android项目
在对话框选择项目设置 - >对话框中按我的应用程序模块上的F4图书馆,我已添加来自Maven
org.springframework.android:spring-android-auth:1.0.1.RELEASE
org.springframework.android:spring-android-core:1.0.1.RELEASE
org.springframework.android:spring-android-rest-template:1.0.1.RELEASE
按OK将代码添加到我的应用程序但是当我要进行项目时,我收到以下错误:
Information:Using javac 1.7.0_51 to compile java sources
Information:Module "mytest-app" was fully rebuilt due to project configuration/dependencies changes
Information:Compilation completed with 33 errors and 32 warnings in 33 sec
Information:33 errors
Information:32 warnings
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
如果我将该库的范围从编译更改为提供应用程序编译,但在启动时我会收到错误java.lang.ClassDefNotFoundError
我怎么用才能解决这个问题?
注意:如果我包含这些库来自java 选项工作正常,但我想从maven中使用
答案 0 :(得分:0)
不确定最近是否回复,我只是从Eclipse用户转移到Intellij并发现了这个问题。
我通过将“依赖存储格式”更改为Intelij IDEA(.iml)来解决问题,当我发现问题时,它是Eclipse(.classpath)
这是在项目设置(F12)下 - >模块 - >依赖