eclipse jar 不匹配,修复您的依赖项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27206151/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jar mismatch, fix your dependencies
提问by Cannon
i've created a new android application project and i got error as soon as it was created.
我创建了一个新的 android 应用程序项目,一创建就出现错误。
Found 2 versions of android-support-v4.jar in the dependency list,
but not all the versions are identical (check is based on SHA-1 only at this time).
All versions of the libraries must be the same at this time.
Versions found are:
Path: /asuspc/workspace/appcompat_v7/libs/android-support-v4.jar
Length: 349252
SHA-1: 612846c9857077a039b533718f72db3bc041d389
Path: /asuspc/workspace/USCConverter/libs/android-support-v4.jar
Length: 337562
SHA-1: 27c24d26e4c5d57976e6926367985548678e913c
then i searched for answer and some people say i should delete android-support-v4.jar from libs folder and use only one. when i deleted it from USCConverter project it wasn't solved. then i restored it and deleted from appcompat_v7 and now there is no any error. but i'm afraid will this mess something up? i don't feel like deleting files would solve a problem. and sorry if this sounds stupid, but i'm kind of newbie, what is this appcompat_v7 anyway? and how come projects i created before didn't have this error, even though they had android-support-v4.jar as well? Thanks in advance!
然后我搜索了答案,有人说我应该从 libs 文件夹中删除 android-support-v4.jar 并只使用一个。当我从 USCConverter 项目中删除它时,它没有解决。然后我恢复了它并从 appcompat_v7 中删除,现在没有任何错误。但恐怕这会搞砸吗?我不觉得删除文件会解决问题。对不起,如果这听起来很愚蠢,但我是新手,这个 appcompat_v7 到底是什么?为什么我之前创建的项目没有这个错误,即使它们也有 android-support-v4.jar?提前致谢!
回答by Sarthak Mittal
This issue arises when you have different versions of v4 library inside of your other libraries that you are using in your app, the simplest solution is to copy the v4 library from one of them and then put it in all of your libraries and don't forget to delete the old ones first
当您在应用程序中使用的其他库中有不同版本的 v4 库时,就会出现此问题,最简单的解决方案是从其中一个库中复制 v4 库,然后将其放入所有库中,而不要忘记先删除旧的
回答by Tar?k Yurtlu
I have same proplem. I was working about Facebook with login my application. Solition is : Just kidding. You may see people advice you to delete one of the support jars from your project but this really not solving the problem right way. Eclipse is screaming cause both jars shuld have same checksum, to do that you have to get the latest support jars for both projects. Eclipse have tools for that when you right click your application.
我有同样的问题。我正在使用 Facebook 登录我的应用程序。解决办法是:开个玩笑。您可能会看到人们建议您从项目中删除其中一个支持 jar,但这确实不能以正确的方式解决问题。Eclipse 正在尖叫,因为两个 jar 都应该具有相同的校验和,为此您必须获得两个项目的最新支持 jar。当您右键单击您的应用程序时,Eclipse 具有用于此的工具。
1-Your Project right click / Android Tools / Add Support Library
1-您的项目右键单击/Android 工具/添加支持库
回答by Harshil
This is a generic problem. In eclipse you can add jars in multiple ways :
这是一个通用的问题。在 Eclipse 中,您可以通过多种方式添加 jars:
1> Go to file location of jar (C:\adt-bundle-windows-x86-20140702\sdk\extras\android\support\v7\recyclerview\libs) and copy the jar and paste it into the libs folder of your project. Right Click on jar in libs folder ->Build Path ->Add To Build Path. Now, Right Click on project ->Properties ->Java Build Path ->order and Export => check all the jar you copied.
1> 转到jar的文件位置(C:\adt-bundle-windows-x86-20140702\sdk\extras\android\support\v7\recyclerview\libs)并将jar复制并粘贴到项目的libs文件夹中. 右键单击 libs 文件夹中的 jar ->构建路径->添加到构建路径。现在,右键单击项目->属性->Java 构建路径->订单和导出 => 检查您复制的所有 jar。
2> Create a library project of desired jars go to your project -> right click -> properties -> Android -> (In Library region) Add.. -> select newly created library project -> Ok -> Ok
2> 创建所需 jar 的库项目转到您的项目 -> 右键单击 -> 属性 -> Android ->(在库区域中)添加.. -> 选择新创建的库项目 -> 确定 -> 确定
the problem arises when you use both this approach to add the libraries and there are version conflicts in both this approach.
当您同时使用这种方法来添加库并且这两种方法都存在版本冲突时,就会出现问题。
I removed libraries added using second approach and the problem got resolved for me. Go to Project -> Right click - > properties -> Android -> (In library Region) select your custom library project -> Remove -> Ok
我删除了使用第二种方法添加的库,问题得到了解决。转到项目 -> 右键单击 -> 属性 -> Android ->(在库区域中)选择您的自定义库项目 -> 删除 -> 确定
Removing libraries this way might impact other functions of your project as this library project might contain multiple jars.
以这种方式删除库可能会影响项目的其他功能,因为该库项目可能包含多个 jar。
回答by Giacomo De Bacco
You have to go in your project properties , than androids and in library remove android-support-v4.jar
你必须进入你的项目属性,而不是 androids 和库中的删除 android-support-v4.jar
回答by Daniel Ephraim
I encountered the same problem and solved it by simply deleting the file android-support-v4 from the path similar to yours.
我遇到了同样的问题并通过简单地从类似于您的路径中删除文件 android-support-v4 来解决它。
ie : /asuspc/workspace/appcompat_v7/libs/android-support-v4.jar
即:/asuspc/workspace/appcompat_v7/libs/android-support-v4.jar
this problem usually arise whe you copy your projects in workspace from one location to another.
当您将工作区中的项目从一个位置复制到另一个位置时,通常会出现此问题。