罐不匹配!修正你的依赖 [英] Jar mismatch! Fix your dependencies

查看:164
本文介绍了罐不匹配!修正你的依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重现步骤:

  1. 创建一个Android项目MyApp的
  2. 在进口ActionBarSherlock(ABS),定向ViewPager(DVP),或采用Android的支持库的任何其他开放源码库。
  3. 添加库项目MyApp的

控制台日志:

  [2013年4月17日14点27分12秒 - 的MyApp] Android的支持 -  v4.jar的依赖项列表中找到2个版本,
[2013年4月17号十四时27分12秒 - 的MyApp]但不是所有的版本是相同的(检查只有在这个时候根据SHA-1)。
[2013年4月17号十四时27分12秒 - 的MyApp]所有版本的库必须相同,在这个时候。
[2013年4月17号14点27分十二秒 - 的MyApp]发现版本:
[2013年4月17号14点27分十二秒 - 的MyApp]路径:C:\ Users \用户santhosh \ My_Workspace \ DVP_library \库\ Android的支持,v4.jar
[2013年4月17号14点27分十二秒 - 的MyApp]长度:140011
[2013年4月17号14点27分十二秒 - 的MyApp] SHA-1:fc834ac8147bc4ed0b555f90f500a57d4232c448
[2013年4月17号14点27分十二秒 - 的MyApp]路径:C:\ Users \用户santhosh \ My_Workspace \ abs_library \库\ Android的支持,v4.jar
[2013年4月17号14点27分十二秒 - 的MyApp]长度:271754
[2013年4月17号14点27分十二秒 - 的MyApp] SHA-1:53307dc2bd2b69fd5533458ee11885f55807de4b
[2013年4月17号14点27分十二秒 - 的MyApp]罐不匹配!修正你的依赖
 

我知道我想删除Android支持-v4.jar从libs文件夹,只保留一个副本所有。 但是,这并不能解决我的问题。

当我试图从删除Android的支持,v4.jar 的MyApp ,它给了我下面的错误。

 在删除资源遇到的问题。
 无法删除C:\ Users \用户santhosh \ My_Workspace \ MyApp的\库\ Android的支持 -  v4.jar。
 

当我试图删除Android的支持 - v4.jar从 ABS ,它给了我下面的错误

  ?????不能被解析为一个类型的错误。
 

我试图清理项目,修复项目属性。重新启动Eclipse,建设,进口和重新添加。我试图从一个库复制的支持JAR在libs文件夹到其他。删除这两个库的支持JAR并把它添加到MyApp项目。什么都没有为我工作。

如果我尝试添加一个库,它工作正常。我面临的尝试添加2个或更多的库到单个项目时的问题。

错误让我在MyApp的添加两个库:

 该项目没有建成,因为它的构建路径是不完整的。
找不到类文件android.support.v4.app.FragmentActivity。
修复构建路径,然后尝试建立这个项目的MyApp未知的Java问题
类型android.support.v4.app.FragmentActivity不能得到解决。这是间接地从必需的.class文件MyActivity.java/MyApp/src/com/santhosh/myapp线10 Java问题引用
罐不匹配!修正你的依赖MyApp的未知Android的依赖问题
 

解决方案

使用图书馆项目只是为了支持库

由于 ADT 22 ,使用Eclipse朱诺

我不认为任何上述是真正的最佳答案。我也并不认为这是推荐使用外部JAR 在Eclipse中了(据我所知)。函数

相反,什么工作对我来说是为创建一个单独的空库项目。

然后使用 Android的工具> 添加支持库来得到你需要或想要的最新版本。

从其他项目中删除支持的lib的jar

最后,对于需要它的每一个项目中,添加一个引用到您的新图书馆项目

(项目属性)> 安卓> (库中)> 添加...

然后,所有的项目将不得不使用和更新支持库的单一来源。这也使的javadoc更容易获得工作。

有关的Javadoc如何设置看信息:

<一个href="http://stackoverflow.com/questions/9873152/how-to-attach-javadoc-or-sources-to-jars-in-libs-folder">How附加的javadoc或来源罐子在libs文件夹?

Steps to reproduce:

  1. create a android project "MyApp"
  2. import ActionBarSherlock(ABS),Directional ViewPager(DVP), or any other open source library which use android support library.
  3. Add the libraries to the project "MyApp"

Console log:

[2013-04-17 14:27:12 - MyApp] Found 2 versions of android-support-v4.jar in the dependency list,
[2013-04-17 14:27:12 - MyApp] but not all the versions are identical (check is based on SHA-1 only at this time).
[2013-04-17 14:27:12 - MyApp] All versions of the libraries must be the same at this time.
[2013-04-17 14:27:12 - MyApp] Versions found are:
[2013-04-17 14:27:12 - MyApp] Path: C:\Users\santhosh\My_Workspace\DVP_library\libs\android-support-v4.jar
[2013-04-17 14:27:12 - MyApp]   Length: 140011
[2013-04-17 14:27:12 - MyApp]   SHA-1: fc834ac8147bc4ed0b555f90f500a57d4232c448
[2013-04-17 14:27:12 - MyApp] Path: C:\Users\santhosh\My_Workspace\abs_library\libs\android-support-v4.jar
[2013-04-17 14:27:12 - MyApp]   Length: 271754
[2013-04-17 14:27:12 - MyApp]   SHA-1: 53307dc2bd2b69fd5533458ee11885f55807de4b
[2013-04-17 14:27:12 - MyApp] Jar mismatch! Fix your dependencies

I know i am suppose to delete android-support-v4.jar from libs folder and keep only one copy for all. But, that is not solving my problem.

When i try to delete the android-support-v4.jar from MyApp, it gives me the following error.

 Problems encountered while deleting resources.
 Could not delete 'C:\Users\santhosh\My_Workspace\MyApp\libs\android-support-v4.jar'.

When I try to delete the android-support-v4.jar from ABS, it gives me the following error

 ????? cannot be resolved to a type error.

I have tried to clean the project, Fix Project Properties. Restart eclipse, Build, import and add again. I have tried to copy the support jar in libs folder from one library to other. delete the support jar in both libraries and add it to the MyApp project. Nothing has worked for me.

if i try to add single library, it works fine. i am facing the problem when trying to add 2 or more libraries to a single project.

error getting when I add two libraries in MyApp:

The project was not built since its build path is incomplete. 
Cannot find the class file for android.support.v4.app.FragmentActivity. 
Fix the build path then try building this project MyApp Unknown Java Problem
The type android.support.v4.app.FragmentActivity cannot be resolved. It is indirectly referenced from required .class files MyActivity.java/MyApp/src/com/santhosh/myapp    line 10 Java Problem
Jar mismatch! Fix your dependencies MyApp Unknown Android Dependency Problem

解决方案

Use a Library Project just for the Support Library

As of ADT 22, using Eclipse Juno

I don't think any of the above are really the best answers. I also don't think it is recommended to use the external jar function in Eclipse anymore (AFAIK).

Rather, what worked for me is to create a separate empty library project.

Then use Android tools > Add Support Library to get the latest version you need or want.

Then remove the support lib jar from all other projects.

Finally, for every project that requires it, add a reference to your new Library project

(project properties) > Android > (Library box) > Add...

Then all your projects will have a single source to use and update the support library. This also makes javadocs easier to get working.

For info on how to setup the javadocs see:

How to attach javadoc or sources to jars in libs folder?

这篇关于罐不匹配!修正你的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆