'Could not resolve all files for configuration ':app:debugRuntimeClasspath'. error

I've upgraded my android studio to the latest version (bumblebee) and opened a new project. I tried implementing a library I've used in the past:

    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'

but I've been getting this error: Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

Whenever I remove the implementation the error disappears. the implementation works on projects created on previous android studio version so why doesn't it work on the latest one?

this is my project build.grade:

buildscript {
repositories {
    google()
    mavenCentral()
    maven { url "https://jitpack.io" }
}

dependencies {
    classpath 'com.android.tools.build:gradle:7.1.2'
    classpath 'com.google.gms:google-services:4.3.10'
}

plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
}

and this is my app build.gradle:

plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdk 31
defaultConfig {
    applicationId "com.example.nobook"
    minSdk 24
    targetSdk 31
    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 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-database:20.0.4'
implementation 'com.google.firebase:firebase-auth:21.0.2'
implementation 'com.google.firebase:firebase-storage:20.0.1'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.itextpdf:itextg:5.5.10'
implementation platform('com.google.firebase:firebase-bom:29.0.4')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source