0

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'

1 Answers1

0

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()
    ..
        }

}
Sandesh Khutal
  • 1,712
  • 1
  • 4
  • 17
  • try that too, but it gives an error so you have these lines in the gradle at the project level: `plugins { id 'com.android.application' version '7.2.1' apply false id 'com.android.library' version '7.2.1' apply false }` but if I delete it I get other errors – joshua multiverse Jun 24 '22 at 16:55
  • @joshuamultiverse can you add screenshot so I will get more Idea. – Sandesh Khutal Jun 24 '22 at 16:56
  • im sorry im a beginner, wait a moment – joshua multiverse Jun 24 '22 at 16:57
  • `Build file 'C:\Users\USER\AndroidStudioProjects\AppProtector\build.gradle' line: 19 Could not compile build file 'C:\Users\USER\AndroidStudioProjects\AppProtector\build.gradle'. > startup failed: build file 'C:\Users\USER\AndroidStudioProjects\AppProtector\build.gradle': 19: only buildscript {} and other plugins {} script blocks are allowed before plugins {} blocks, no other statements are allowed` that error comes out, that just line 19 is the aforementioned plugins{} – joshua multiverse Jun 24 '22 at 16:59
  • It could already be solved with jcenter(), just adding it in the settings.gradle, but not in the build.gradle as allprojects{} Thanks for the help – joshua multiverse Jun 24 '22 at 17:08