簡體   English   中英

Gradle:無法解決(mavenCentral)

[英]Gradle: Failed to resolve (mavenCentral)

由於以下錯誤,我的gradle同步失敗:

錯誤信息

我不知道我的gradle配置到底出了什么問題(maven import一定有問題)。 這些是文件:

build.gradle (頂級)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        mavenCentral()

        maven { url "https://repo.spring.io/release" }
        maven { url "https://repo.spring.io/milestone" }
        maven { url "https://repo.spring.io/snapshot" }
        maven { url 'https://repo.spring.io/libs-milestone' }

        flatDir {
            dirs 'libs'
        }
    }
}

build.gradle (應用程序)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.confidential.packageid"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            res.srcDirs = ['src/main/res', 'src/main/res-img']
        }
    }
}

repositories {
    mavenCentral()

    maven { url "https://repo.spring.io/release" }
    maven { url "https://repo.spring.io/milestone" }
    maven { url "https://repo.spring.io/snapshot" }
    maven { url 'https://repo.spring.io/libs-milestone' }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile(name:'sdk-release', ext:'aar')

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.android.gms:play-services:10.2.1'
    compile 'com.android.support:support-v4:25.3.1'

    ...

    testCompile 'junit:junit:4.12'

    ...

    compile 'com.noveogroup.android:androidlogger:1.3.6'
    compile 'com.github.ybq:Android-SpinKit:1.0.5'
}


apply plugin: 'com.google.gms.google-services'

我的gradle文件的哪一部分是錯誤的?

好吧,這存在... https://jcenter.bintray.com/com/noveogroup/android/android-logger/1.3.6/

(您缺少破折號android - logger

也許按照這里的指示? https://github.com/ybq/Android-SpinKit#gradle-dependency

例如,

allprojects {
    jcenter()
    // mavenCentral()

    repositories {
        maven { url "https://jitpack.io" }

        ...
    }

記住: jcenter()是的超集 mavenCentral()

Android buildscript存儲庫:jcenter VS mavencentral


然后,反抗其他東西

// compile 'com.android.support:appcompat-v7:25.3.1' // not needed
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-core:10.2.1'  // Should really use 'database' or 'messaging' instead
compile 'com.google.android.gms:play-services:10.2.1' // Should be split
// compile 'com.android.support:support-v4:25.3.1' // not needed

請參閱“選擇性地將API編譯到您的可執行文件中” https://developers.google.com/android/guides/setup

暫無
暫無

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

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