嘿伙计我试图通过将此行添加到我的项目build.grade文件来为我的Android应用添加卡片库:
compile 'com.github.gabrielemariotti.cards:library:1.9.1'
但是,当我重新同步成绩档案时,我收到此错误:
无法解决:com.github.gabrielemariotti.cards:library:1.9.1
继承我的build.grade文件:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Will compile all the Libraries inside the 'libs' folder
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.github.gabrielemariotti.cards:library:1.9.1'
}
android {
compileSdkVersion 21
buildToolsVersion "22.0.0"
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 maintools 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')
}
}
我是android studio的新手,所以我能解决这个错误的任何帮助都会很棒!
提前感谢一百万人!
答案 0 :(得分:0)
请检查Gradle面板(通常位于屏幕右侧),表示未启用离线模式。
修改的
另外,我没有在您的构建文件中看到repositories
部分(独立部分,而不是buildscript
下),请尝试添加:
repositories {
jcenter()
}
答案 1 :(得分:0)