我在android studio和gradle中遇到了一些问题...... 首先,我应该提一下,我下载IFixit android project这是开源的,并在我的项目中导入它的一部分,但是出了点问题。当我在我的项目中添加依赖项并构建gradle时导致Failng To Find !!!例如,下面是其中两个:
compile "com.github.chrisbanes.pulltorefresh:pulltorefresh:2.1.2"
compile 'com.marczych.androidsectionheaders:androidsectionheaders:1.0.0'
我通过更改名称来解决一些错误,但上面的文件根本不起作用!对我来说很奇怪的是我的build.gradle文件使用jcenter()存储库,但IFixit使用mavenCentaral()并且实际上我不知道有什么区别!我将mavenCentral()添加到我的存储库但没有发生任何事情!< / p>
我将第一个链接更改为:
compile "com.github.chrisbanes.pulltorefresh:library:2.1.1"
并成功构建gradle,但我的activity类无法像这样解析导入:
import com.handmark.pulltorefresh.library.PullToRefreshBase;
并且知道这些课程!
我应该提一下,我使用android studio v0.8.6和gradle:0.13。+(2.1)和我项目的最低要求sdk是4.0
有没有办法解决我的问题并导入依赖项而不会出错? 我将不胜感激任何建议...... 提前谢谢......
更新(解决方案):
我通过在我的存储库中添加以下行来解决问题:
maven {
url 'https://raw.github.com/iFixit/ark/master/releases/'
}
答案 0 :(得分:0)
当您指定所需的依赖项版本时,应尝试使用“+”符号,这将为您提供“最新”版本。
例如
compile "com.github.chrisbanes.pulltorefresh:library:2.+"
会为您提供最新的2.x版本
compile "com.github.chrisbanes.pulltorefresh:library:+"
会为您提供最新的一个可用x.x版本
但是对于那些不断更新repos和夜间构建的项目来说,这并不是“推荐”,因为不稳定的东西可能会出现并影响项目,但有时它可能是“ok”。
最佳。
答案 1 :(得分:0)
调查错误,事情的数量突出:
com.handmark.pulltorefresh.library.PullToRefreshBase
课程不在com.github.chrisbanes.pulltorefresh:library
但在com.github.chrisbanes.pulltorefresh:sample
。pulltorefresh
的2.1.2版没有发布。最新的是2.1.1。基于此,我建议您将com.github.chrisbanes.pulltorefresh:library
和com.github.chrisbanes.pulltorefresh:library
(以及可能com.github.chrisbanes.pulltorefresh:extras
)添加到您的依赖项中,所有版本都是2.1.1。应该可以做到这一点。