Eclipse中android项目如何导入开源jar包
的有关信息介绍如下:在android中我们经常会使用到一些好用的、对我们项目有帮助的开源项目,如slidingmenu,Android-ViewPagerIndicator或者android-actionbar啊 ,下面来说如何导入第三方jar,使我们的项目正确运行。
在这里我以slidingmenu为例。首先我们导入slidingmenu项目
我们右键查看属性,看其【android】栏目,Eclipse自动帮其勾选了【Is Library】
意思就是说这个项目可以供其他项目使用
那么如何去使用这个项目呢。新建项目后我们右键属性,在【android】栏目,【Library】属性中点击【add】
在弹出框中选择可使用的项目
点击【Apply】然后点击OK
这样我们就可以正常使用了开源项目slidingmenu了。我们会发现我们的android项目下Android Dependencies多了一个我们导入slidingmenu的jar包了
如果报错如:
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: D:\ProgramData\workspaces\app\library\libs\android-support-v4.jar
Length: 385685
SHA-1: 48c94ae70fa65718b382098237806a5909bb096e
Path: D:\ProgramData\workspaces\app\DingTop\libs\android-support-v4.jar
Length: 758727
SHA-1: efec67655f6db90757faa37201efcee2a9ec3507
Jar mismatch! Fix your dependencies
意思是:有2个v4的jar包 且SHA-1不一致.我们需要复制slidingmenu中的v4jar包替换我们项目中的v4jar包。
注意我们项目的运行版本最好为14
然后我们就可以正确使用slidingmenu等一系列的开源项目了