在android中我们经常会使用到一些好用的、对我们项目有帮助的开源项目,如sli蟠校盯昂dingmenu,Android-ViewPagerIndicator或者android-actionbar啊 ,下面来说如何导入第三方jar,使我们的项目正确运行。
工具/原料
Eclipse
使用slidingmenu项目jar包
1、在这里我以slidingmenu为例。首先我们导入slidingmenu项目
2、我们右键查看属性,看其【android】栏目,Eclipse自动帮其勾选了【Is Library】意思就是说这个项目可以供其他项目使用
3、那么如何去使用这个项目呢。新建项目后我们右键属性,在【android】栏目,【Library】属性中点击【add】
4、在弹出框中选择可使用的项目
5、点击【Apply】然后点击OK
6、这样我们就可以正常使用了开源项目slidingmenu了。我们会发现我们的android项目下Android Dependencies多了一个我们导入slidingmenu的jar包了
注意
1、如果报错如:Found 2 versions of android-support-v4.jar in the dependen艘早祓胂cy 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.jarLength: 385685SHA-1: 48c94ae70fa65718b382098237806a5909bb096ePath: D:\ProgramData\workspaces\app\DingTop\libs\android-support-v4.jarLength: 758727SHA-1: efec67655f6db90757faa37201efcee2a9ec3507Jar mismatch! Fix your dependencies意思是:有2个v4的jar包 且SHA-1不一致.我们需要复制slidingmenu中的v4jar包替换我们项目中的v4jar包。
2、注意我们项目的运行版本最好为14
3、然后我们就可以正确使用slidingmenu等一系列的开源项目了