我正在尝试将此库添加到我的项目中:
- com.loopj.android:android-async-http:1.4.6
- com.google.apis:google-api-services-analytics:v3-rev115-1.20.0
- com.github.castorflex.smoothprogressbar:library:1.1.0
但是 Android Studio 返回此错误:
Error:(8, 13) Failed to resolve: com.github.castorflex.smoothprogressbar:library:1.1.0
Error:(6, 13) Failed to resolve: com.loopj.android:android-async-http:1.4.6
Error:(7, 13) Failed to resolve: 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 工作完美,我还没有进行任何配置。
任何帮助将不胜感激。
最佳答案
首先尝试将以下代码添加到您的项目 build.gradle
文件中,或者将其添加到现有存储库中
repositories {
mavenCentral()
}
您还可以启用“离线模式”
。检查 File -> Build,Execution,Deployment-> Maven/Gradle "Offline work"
是否已启用,如果是,只需禁用它并 Sync Gradle
并让我知道结果。
关于java - 无法将 Android Studio 与 Maven 存储库同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30031500/