2

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:

Mayur Gajra
  • 8,285
  • 6
  • 25
  • 41
Atif Sheikh
  • 105
  • 4
  • 12
  • below is my repositories tag where I have mentioned maven tag: allprojects { repositories { maven { url "http://jcenter.bintray.com" } } } – Atif Sheikh Feb 17 '19 at 07:06

3 Answers3

2

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()
      ………..
   }
}
Kourosh
  • 308
  • 5
  • 12
  • 1
    Hi Kourosh, thank you for answering, I have already added jcenter() in my repositories but still getting the same error. After replacing compile tag with implementation tag I am getting this below error: gradle DSL method not found : 'implementation()' – Atif Sheikh Feb 17 '19 at 08:08
  • @AtifSheikh you must update the gradle plugin in your project/build.gradle. check this link : https://stackoverflow.com/questions/17727645/how-to-update-gradle-in-android-studio – Kourosh Feb 17 '19 at 08:51
  • jcenter() is already deprecated by the way. There has to be some other solution to this – SDK4551 Jun 12 '22 at 13:23
  • if any one upload this lib to mavenCentral() It will be good – Chirag Thummar Jul 11 '23 at 05:06
0

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'
        //
    }
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

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.