Unable to import library from GitHub

Viewed 49

I am trying to use this library in my Android Studio project: https://github.com/yarolegovich/LovelyDialog

I added implementation 'com.yarolegovich:lovely-dialog:1.1.1' in my build.gradle but I'm still not able to use it, why?

enter image description here

1 Answers

This library is available only to jJcenter so you need to add this code to the root build.gradle file

allprojects {
    repositories {
         maven { url 'https://jitpack.io' }
    }
}

or jcenter() if you are using old Gradle version like this code from the library repository

https://github.com/yarolegovich/LovelyDialog/blob/aa6a2223d5e9d5c655aa895f173d92c45a8b15da/build.gradle#L16

Also make sure gradle offline mode is disable before sync

enter image description here

Make sure you have jcentre in in settings.gradle

pluginManagement {
    repositories {
        jcentre()    // here
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        jcentre()    // here
        google()
        mavenCentral()
    }
}
Related