android开发小技巧2(Dx 1 error; aborting)

http://www.cnblogs.com/BlueVienna/archive/2012/05/28/2520902.html

工程上有红叉,不知道少了什么,但是袋中却没有任何错误,运行程序报错为: 

trouble processing "javax/xml/datatype/DatatypeConstants$Field.class":

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

This is often due to inadvertentlyincluding a core library file
in your application's project, whenusing an IDE (such as
Eclipse). If you are sure you're notintentionally defining a
core class, then this is the mostlikely explanation of what's
going on.

However, you might actually be tryingto define a class in a core
namespace, the source of which you mayhave taken, for example,
from a non-Android virtual machineproject. This will most
assuredly not work. At a minimum, itjeopardizes the
compatibility of your app with futureversions of the platform.
It is also often of questionablelegality.

If you really intend to build a corelibrary -- which is only
appropriate as part of creating a fullvirtual machine
distribution, as opposed to compilingan application -- then use
the "--core-library" option tosuppress this error message.

If you go ahead and use"--core-library" but are in fact
building an application, then beforewarned that your application
will still fail to build or run, atsome point. Please be
prepared for angry customers who find,for example, that your
application ceases to function oncethey upgrade their operating
system. You will be to blame for thisproblem.

If you are legitimately using somecode that happens to be in a
core package, then the easiest safealternative you have is to
repackage that code. That is, move theclasses in question into
your own package namespace. This meansthat they will never be in
conflict with core system classes.JarJar is a tool that may help
you in this endeavor. If you find thatyou cannot do this, then
that is an indication that the pathyou are on will ultimately
lead to pain, suffering, grief, andlamentation.
 
控制台:
[2011-07-29 11:02:55 - GalleryView] Dx 1 error; aborting
[2011-07-29 11:02:55 - GalleryView] Conversion to Dalvik formatfailed with error 1
其实这个错误很简单,你的jar包在工程里面不止一个,所以删除其他,留一个jar包即可,然后 重新运行工程。

我要运行的时候报错控制台打印UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/kenai/jbosh/AbstractAttr;
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:372)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:59)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:313)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.dx.command.dexer.Main.run(Main.java:185)
[2011-05-11 10:13:02 - Wildgoose] Dx at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
[2011-05-11 10:13:02 - Wildgoose] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[2011-05-11 10:13:02 - Wildgoose] Dx at java.lang.reflect.Method.invoke(Method.java:597)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:585)
[2011-05-11 10:13:02 - Wildgoose] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:490)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
[2011-05-11 10:13:02 - Wildgoose] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
[2011-05-11 10:13:02 - Wildgoose] Dx 1 error; aborting

[2011-05-11 10:13:02 - Wildgoose] Conversion to Dalvik format failed with error 1


和一个Your project contains error(s), please fix them before running your application.提示框...

网上很多说是因为包重复,我的问题其实是AbstractAttr这个类重复加载了,由于我的android项目中引入了一个java项目,而俩个项目中都含有一个相同的类,包名也一样,就出现这个错误!调了我俩天啊,终于出来了,累死我了!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值