如果我缺少明显的东西,我深表歉意,但是最近我将项目从Eclipse转换为Android Studio(和Gradle),并尝试使用Melnykov's library添加对Floating Action Buttons的支持,但是Gradle无法解决它。我以为将compile 'com.melnykov:floatingactionbutton:1.3.0'
添加到应用程序的build.gradle
文件中很简单。我是否缺少某些内容,或者该资源无法下载或什么?提前谢谢。
我的应用程序的build.gradle
文件:
apply plugin: 'android'
dependencies {
compile 'com.android.support:support-v4:22.1.0'
compile files('libs/opencsv-3.1.jar')
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.melnykov:floatingactionbutton:1.3.0'
}
android {
compileSdkVersion 22
buildToolsVersion "22"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
我得到的错误是
Error:(6, 13) Failed to resolve: com.makovkastar:floatingactionbutton:1.3.0
最佳答案
您必须添加gradle应该从中下载aar的存储库。
repositories {
jcenter()
}
如果没有这一部分,gradle不知道在哪里可以找到依赖项。
其他库不需要存储库,因为它们是本地jar(可以在lib文件夹中找到):
compile files('libs/opencsv-3.1.jar')
或本地专家(由sdk管理器提供)
compile 'com.android.support:support-v4:22.1.0'
compile 'com.android.support:appcompat-v7:22.1.0'
关于android - 无法在gradle中解析com.melnykov:floatingactionbutton:1.3.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29859853/