簡體   English   中英

我的Android Studio Gradle無法從Maven Central獲取插件

[英]My Android Studio Gradle is not getting the plugin from maven central

我試圖將smoothprogressbar庫添加到我的android項目中

我將這些行添加到build.gradle中

dependencies {
    // of course, do not write x.x.x but the version number
    compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}

當我同步gradle時,它的說法是找不到:com.github.castorflex.smoothprogressbar:library:0.5.1

我試圖將mavenCentral()和maven url放入build.gradle和我在stackoverflow中發現的其他解決方案中,但似乎沒有任何效果。

編輯:

這是我完整的gradle文件

apply plugin: 'com.android.application'


repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    //compile 'com.android.support:cardview-v7:21.+'
    compile('com.google.http-client:google-http-client-android:1.18.0-rc') {
        exclude(group: 'com.google.android', module: 'android')
        exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
    }
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile project(path: ':backend', configuration: 'android-endpoints')
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile project(':library')
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile 'com.android.support:support-v4:19.+'
    compile 'com.google.android.gms:play-services:4.4.52'
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile 'com.android.support:support-v13:19.+'
    compile 'com.google.code.gson:gson:2.+'
    compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}

android {
    signingConfigs {
        ...
    }
    compileSdkVersion 19
    buildToolsVersion '20.0.0'
    defaultConfig {
        applicationId ...
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
    }
    dexOptions {
        preDexLibraries = false
    }
    productFlavors {
    }
}

為我工作。 您應該發布更多build.gradle腳本(特別是嘗試將mavenCentral()放入腳本中的方式),但是要點是您需要在腳本中的android {}塊之外添加以下內容(並且除了buildscript {}塊中的類似代碼之外):

buildscript {
    // ...
}

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}

android {
    // ...
}

然后與Gradle重新同步您的項目。

使用此方法:

compile 'com.github.castorflex.smoothprogressbar:library:0.5.2@aar'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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