'Failed to resolve: com.github.barteksc:android-pdf-viewer:2.8.1
I am trying use this library in my Project. But i am unable to download it by adding it in gradle build. In fact i am even unable to download any library through gradle. I need to manually download a jar file and add that as a library. But in this case I couldn't find the jar file for PDFviewer.
Build.gradle (Module)
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:23.0.1'
testCompile 'junit:junit:4.12'
compile files('libs/jsoup-1.8.1.jar')
compile files('libs/log4j-1.2.9.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/json-simple-1.1.jar')
compile files('libs/glide-3.7.0.jar')
compile files('libs/commons-codec-1.9.jar')
compile files('libs/asmack.jar')
compile files('libs/android-logging-log4j-1.0.3.jar')
compile 'com.github.barteksc:android-pdf-viewer:2.8.1' //unable to add this.
}
Build.gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
// google()
// mavenLocal() // tried everything
}
}
I have tried almost everything for the past three days given in SO but still couldn't find any solution to this. It will be helpful even if i get the jar file.
Solution 1:[1]
You should add
repositories
{
maven { url "http://jcenter.bintray.com" }
}
Solution 2:[2]
it's a problem with jCenter (deprecated) when he's drop.
add :
allprojects {repositories {
mavenCentral()
google()
gradlePluginPortal()
}
}
Solution 3:[3]
Simply add this line into the build.gradle(app level)
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
If you have android studio bumblebee or android studio arctic fox then,
add gradlePluginPortal() into settings.gradle file
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
Solution 4:[4]
Add the maven URL and GitHub dependencies...
You might turn on your internet connection for Gradle to download necessary dependencies...
Solution 5:[5]
Make sure adding this to your allprojects repositories like this inside android\build.gradle file: do not forget that it should be SSL secured using https://
repositories
{
maven {
url ("https://jcenter.bintray.com")
}
}
Solution 6:[6]
Simply add this line into the build.gradle(app level)
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
If you have android studio bumblebee or android studio arctic fox then,
add gradlePluginPortal() into settings.gradle file
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
also add
android.enableJetifier=true in gradle.properties
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | François LE FORT |
Solution 3 | Prince Patel |
Solution 4 | Banu |
Solution 5 | Mani Malekizadeh |
Solution 6 | user158452 |