Sebastian Schneider
Sebastian Schneider

Reputation: 5532

Gradle: Failed to resolve (mavenCentral)

My gradle sync fails because of this error:

Error message

I don't know exactly what is wrong with my gradle configuration (It must be something with maven import). Here are the files:

build.gradle (Top level)

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 (app)

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'

Which part of my gradle files is wrong?

Upvotes: 1

Views: 1957

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191681

Well, this exists... https://jcenter.bintray.com/com/noveogroup/android/android-logger/1.3.6/

(You're missing a dash. android-logger)

And maybe follow directions here? https://github.com/ybq/Android-SpinKit#gradle-dependency

For example,

allprojects {
    jcenter()
    // mavenCentral()

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

        ...
    }

Remember: jcenter() is a superset of mavenCentral()

Android buildscript repositories: jcenter VS mavencentral


Then, regading other things

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

Refer to "Selectively compiling APIs into your executable" https://developers.google.com/android/guides/setup

Upvotes: 2

Related Questions