简体   繁体   English

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

[英]Unable to sync Android Studio with Maven repository

I'm trying to add this libraries to my project: 我正在尝试将此库添加到我的项目中:

But Android Studio is returning this errors: 但是Android Studio返回此错误:

Error:(8, 13) Failed to resolve: com.github.castorflex.smoothprogressbar:library:1.1.0 错误:(8,13)无法解决:com.github.castorflex.smoothprogressbar:library:1.1.0

Error:(6, 13) Failed to resolve: com.loopj.android:android-async-http:1.4.6 错误:(6,13)无法解决: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 错误:(7,13)无法解决:com.google.apis:google-api-services-analytics:v3-rev115-1.20.0

This is my build.grade file: 这是我的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')
    }
}

Do I have to configure something?? 我必须配置一些东西吗? for example com.google.android.gms:play-services:6.5.87 is working perfect and I have not done any configuration. 例如com.google.android.gms:play-services:6.5.87运行完美,我没有做任何配置。

Any help will be appreciated. 任何帮助将不胜感激。

Firstly try to add to your Project build.gradle file following code or just add it to existent repositories 首先尝试通过以下代码将其添加到您的Project build.gradle文件中,或仅将其添加到现有存储库中

repositories {
        mavenCentral()
    }

Also you may have "Offline mode" enabled. 另外,您可能已启用"Offline mode" Check if File -> Build,Execution,Deployment-> Maven/Gradle "Offline work" is enabled, if so just disable it and Sync Gradle 检查是否已启用File -> Build,Execution,Deployment-> Maven/Gradle "Offline work" ,如果已启用,则将其禁用并Sync Gradle

And let me know results. 让我知道结果。

The Gradle builds which you mentioned perfectly compiled with mine. 您提到的Gradle构建与我的完美编译。 I suggest you to clean your project and restart android studio and try once again. 我建议您清理项目并重新启动android studio,然后再试一次。 Please let us know if the problem persists. 如果问题仍然存在,请告知我们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM