java - 无法将 Android Studio 与 Maven 存储库同步

标签 java android maven android-studio gradle

我正在尝试将此库添加到我的项目中:

但是 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/

相关文章:

java - Android - 迁移到 HoloEverywhere

android - 在 Android 代码中制作错误消息

java - netbeans显示/打印受min函数影响的一行mysql数据

java - 存储过程和准备语句错误

android - Android 上使用了哪些架构模式?

java - WAR Web 应用程序重新部署依赖项

java - 通过ivy依赖解析下载Netty失败

java - 如何使用 antrun 插件通过 maven 将类作为 jar 文件运行

java - 从命令行使用 evosuite

android - XML文件使Android按钮消失