[英]Unable to sync Android Studio with Maven repository
我正在尝试将此库添加到我的项目中:
但是Android Studio返回此错误:
错误:(8,13)无法解决:com.github.castorflex.smoothprogressbar:library:1.1.0
错误:(6,13)无法解决:com.loopj.android:android-async-http:1.4.6
错误:(7,13)无法解决:com.google.apis:google-api-services-analytics:v3-rev115-1.20.0
这是我的build.grade文件:
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':librarySmartHotel')
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.google.apis:google-api-services-analytics:v3-rev115-1.20.0'
compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
compile 'com.google.android.gms:play-services:6.5.87'
}
android {
compileSdkVersion 19
buildToolsVersion "22.0.1"
defaultConfig {
multiDexEnabled true
}
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')
}
}
我必须配置一些东西吗? 例如com.google.android.gms:play-services:6.5.87运行完美,我没有做任何配置。
任何帮助将不胜感激。
首先尝试通过以下代码将其添加到您的Project build.gradle
文件中,或仅将其添加到现有存储库中
repositories {
mavenCentral()
}
另外,您可能已启用"Offline mode"
。 检查是否已启用File -> Build,Execution,Deployment-> Maven/Gradle "Offline work"
,如果已启用,则将其禁用并Sync Gradle
让我知道结果。
您提到的Gradle构建与我的完美编译。 我建议您清理项目并重新启动android studio,然后再试一次。 如果问题仍然存在,请告知我们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.