Android引入第三方包出现conversion to dalvik format failed with error 1 解决

来源:互联网 发布:java薪资水平 编辑:程序博客网 时间:2024/06/07 13:44

 

在Android项目中引入第三方包出现错误:conversion to dalvik format failed with error 1。

在引入包的时候,如果你直接Add external jar....的话,会发现部分包加入没有问题,部分包加入有问题。

在android项目中引入第三方包最好不要这么做。

解决方法:

官方文档说明:

You can use a third party JAR in your application by adding it to your Eclipse project as follows:

  1. In the Package Explorer panel, right-click on your project and selectProperties.
  2. Select Java Build Path, then the tab Libraries.
  3. Press the Add External JARs... button and select the JAR file.

Alternatively, if you want to include third party JARs with your package, create a new directory for them within your projectand select Add Library... instead.

It is not necessary to put external JARs in the assets folder.

 

翻译后意思:

1.右键项目,选择properties;

2.选择Java Build Path,切换到Libraries;

3.点击Add Library...,选择User Library后Next;

4. 在出现的界面中点击“New..”

5. 在弹出的界面中随便取一个名字,点击“确定”
6. 点击“Add jars”按钮选择你要引入的第三方包,点击“确定”即可。

 

这两种引包的方法如果是我们常使用的java或者web项目,一点问题都没有的。不知道为什么android项目存在这么垃圾问题。还是按照规范来做吧。管它为什么的