在eclipse中添加库项目时出错

时间:2012-10-09 06:04:23

标签: android jar android-library

enter image description here

我在eclipse中添加了库项目。但我得到了以下错误

[2012-10-09 11:25:38 - Share] Found 2 versions of android-support-v4.jar in the dependency list,
[2012-10-09 11:25:38 - Share] but not all the versions are identical (check is based on SHA-1 only at this time).
[2012-10-09 11:25:38 - Share] All versions of the libraries must be the same at this time.
[2012-10-09 11:25:38 - Share] Versions found are:
[2012-10-09 11:25:38 - Share] Path: D:\android 4 tools\work1\Share\libs\android-support-v4.jar
[2012-10-09 11:25:38 - Share]   Length: 349252
[2012-10-09 11:25:38 - Share]   SHA-1: 612846c9857077a039b533718f72db3bc041d389
[2012-10-09 11:25:38 - Share] Path: D:\android 4 tools\work1\Android-Feather\libs\android-support-v4.jar
[2012-10-09 11:25:38 - Share]   Length: 337562
[2012-10-09 11:25:38 - Share]   SHA-1: 27c24d26e4c5d57976e6926367985548678e913c
[2012-10-09 11:25:38 - Share] Jar mismatch! Fix your dependencies

1 个答案:

答案 0 :(得分:27)

在库和主项目中使用相同的 android-support-v4.jar 库。

要执行此操作,请从库和主项目构建路径中删除android-support-v4.jar文件,然后从libs路径中删除android-support-v4.jar。然后在库和主项目中重新插入相同的android-support-v4.jar。然后使用add to build path将lib添加到项目中。

这将解决您的问题。

How to add or remove support lib in project

如何在项目中添加支持Lib:

要将最新的支持lib添加到您的android项目,请执行以下步骤:

  1. 右键点击你的android项目。
  2. 选择Android Tools
  3. 然后选择Add Support Library
  4. 然后按照屏幕说明进行操作,这会将最新的支持库添加到您的libs文件夹中。

    How to add support lib to project

    现在右键单击libs文件夹中的android-support-v4.jar文件,然后按照我的描述将其添加到构建路径。您将在项目中获得最新的支持库。

    <强>更新 正如'Doctoror Drive'所说,您只需在support library中添加library project即可。因此,只需将support library添加到library project