无法将库包含到 Android Studio 项目中
Not able to include the library to Android Studio Project
我正在尝试使用自述文件中提到的依赖项将 ShowcaseView 库包含到我的项目中
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
但是 Android Studio 对此给出了错误。
我正在使用 Android Studio 1.0.2。
谁能告诉我我在这里错过了什么?
Error:Could not download artifact 'library.aar
(com.github.amlcurran.showcaseview:library:5.0.0)': No cached version
available for offline mode
我假设您在依赖部分的 Build.gradle (Module: app)
文件中正确地为库添加了 compile
行。
然后确定两件事:
1)重新启动您的 IDE
2)您有互联网连接。
3) 将 MavenCentral()
添加到 buildscript
部分 build.gradle (Project: you_project_name)
中的存储库
repositories {
mavenCentral()
}
4)点击Sync Now
看看这个answer
在你的 build.gradle
中包含 http://jcenter.bintray.com
作为存储库 before mavenCentral
像这样:
repositories {
maven { url "http://jcenter.bintray.com" }
mavenCentral()
}
像往常一样在您的项目依赖项中使用:
dependencies {
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
}
为什么在 mavenCentral 之前?
否则gradle会先在mavenCentral
中查找,找到ShowCaseView
版本相同的神器,但是找不到包会报错,没有找相同的工件与其他存储库中的另一个包装。
附加提示:
如果您遇到任何其他库的此类错误,请转到 bintray.com 然后搜索您想要的库。如果在那里找到它,则单击该库,您可以找到有关如何设置该库的说明。希望它能帮助很多来搜索相同查询的人。
我正在尝试使用自述文件中提到的依赖项将 ShowcaseView 库包含到我的项目中
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
但是 Android Studio 对此给出了错误。 我正在使用 Android Studio 1.0.2。 谁能告诉我我在这里错过了什么?
Error:Could not download artifact 'library.aar (com.github.amlcurran.showcaseview:library:5.0.0)': No cached version available for offline mode
我假设您在依赖部分的 Build.gradle (Module: app)
文件中正确地为库添加了 compile
行。
然后确定两件事:
1)重新启动您的 IDE
2)您有互联网连接。
3) 将 MavenCentral()
添加到 buildscript
部分 build.gradle (Project: you_project_name)
中的存储库
repositories {
mavenCentral()
}
4)点击Sync Now
看看这个answer
在你的 build.gradle
中包含 http://jcenter.bintray.com
作为存储库 before mavenCentral
像这样:
repositories {
maven { url "http://jcenter.bintray.com" }
mavenCentral()
}
像往常一样在您的项目依赖项中使用:
dependencies {
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
}
为什么在 mavenCentral 之前?
否则gradle会先在mavenCentral
中查找,找到ShowCaseView
版本相同的神器,但是找不到包会报错,没有找相同的工件与其他存储库中的另一个包装。
附加提示:
如果您遇到任何其他库的此类错误,请转到 bintray.com 然后搜索您想要的库。如果在那里找到它,则单击该库,您可以找到有关如何设置该库的说明。希望它能帮助很多来搜索相同查询的人。