Search code examples
androidmavenandroid-gradle-pluginjcenter

Android Studio does not import dependency from jCenter or Maven Central


There is a very weird issue that I cannot explain. I have a library in both jCenter and Maven Central accessible like this:

implementation 'com.github.kostasdrakonakis:spinner-preference:1.0.0'

or for Gradle < 3.0

compile 'com.github.kostasdrakonakis:spinner-preference:1.0.0'

I added it as a dependency in my Project in Android Studio and it does not download it.

My app/build.gradle:

dependencies {
    implementation fileTree(includes: ['*.jar'], dir: 'libs')
    implementation 'com.github.kostasdrakonakis:spinner-preference:1.0.0'
    api project(':databasemanager')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'de.greenrobot:greendao:2.1.0'
}

My build.gradle for root project:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        google()
    }
}

The external libraries:

enter image description here

Any Ideas what is happening?


Solution

  • Do you mean to have <packaging> type to be pom inside your .pom file?

    http://repo1.maven.org/maven2/com/github/kostasdrakonakis/spinner-preference/1.0.0/spinner-preference-1.0.0.pom

    http://jcenter.bintray.com/com/github/kostasdrakonakis/spinner-preference/1.0.0/:spinner-preference-1.0.0.pom

    Typically I would expect this to be aar.