Atif Sheikh
Atif Sheikh

Reputation: 115

Dependency Failed to resolve: com.github.barteksc:android-pdf-viewer:2.8.1

I know that this has been asked before, but despite adding maven in repositories cant resolve this error. please help.

Following is my module level gradle file:

Following is my top level gradle file:

Upvotes: 2

Views: 7122

Answers (3)

Mike Schvedov
Mike Schvedov

Reputation: 156

The fact that JCenter is deprecated will not prevent you from using this library. "JFrog will keep JCenter as a read-only repository indefinitely. Customers and the community can continue to rely on JCenter as a reliable mirror for Java packages".

You can add jcenter in your settings.gradle file:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
       jcenter() // Warning: this repository is going to shut down soon
    }
}

So there is nothing to worry about.

If you really want to sleep good at night, you can try to clone the library itself from Github and make your own local copy. I will take some time and work but if you manage to do it, you will have an offline local version of the library.

Maybe I will try to do it myself in the future. Anyway just wanted to give you all the options.

I personally still use JCenter.

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363825

Change your module/build.gradle script.

repositories {
    google()
    jcenter()
}

dependencies {
   //....
   implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
}

To use the implementation DSL you have to update the gradle plugin for android in the top level file:

buildscript {
    repositories {
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        //
    }
}

Upvotes: 0

Kourosh
Kourosh

Reputation: 338

Try this:

implementation 'com.github.barteksc:android-pdf-viewer:3.1.0-beta.1'

or if you want a more stable version:

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

and add jCenter in your repositories:

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

Upvotes: 2

Related Questions