簡體   English   中英

無法將Android Studio與Maven存儲庫同步

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM