Search code examples
androidandroid-studiobuildbuild.gradlelibraries

Failed to resolve one of the libraries in Android Studio gradle dependencies


I want to include a library in Android Studio , but it displays error like below :

Failed to resolve: com.andrognito.pinlockview:pinlockview:2.1.0
Failed to resolve: com.andrognito.patternlockview:patternlockview:1.0.0

How to fix this problem?

-build.gradle (App)

plugins {
id 'com.android.application'
}
android {
    compileSdk 32
    defaultConfig {
        applicationId "com.multiverse.appprotector"
        minSdk 23
        targetSdk 32
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
dependencies {
    implementation 'com.andrognito.pinlockview:pinlockview:2.1.0'
    implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'
}

Other dependencies, which I consider are not relevant to the error:

  • implementation 'androidx.appcompat:appcompat:1.4.2'
  • implementation 'com.google.android.material:material:1.6.1'
  • implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  • implementation 'junit:junit:4.13.2'
  • implementation 'androidx.test.ext:junit:1.1.3'
  • implementation 'androidx.test.espresso:espresso-core:3.4.0'
  • implementation 'androidx.recyclerview:recyclerview:1.2.1'
  • implementation 'androidx.cardview:cardview:1.0.0'
  • implementation 'androidx.biometric:biometric:1.1.0'

Solution

  • Please go through link

    If possible try latest library for the same because both libraries are not maintained from last few years.

    Add jCenter repository in project’s build.gradle file as shown below and sync your project:

    allprojects {
       repositories {
           jcenter()
           . . .
       }
    }
    

    Note- In the latest android code it will available in settings.gradle file

      pluginManagement {
            repositories {
         jcenter()
               ...
            }
        }
        dependencyResolutionManagement {
            repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
            repositories {
              jcenter()
        ..
            }
    
    }