Reputation: 23
I created a project on Android Studio 2.3.3 and added pdf viewer as below:
compile 'com.github.barteksc:android-pdf-viewer:2.0.3'
I can build the project without error and I can display pdf file.
Now I am trying to add this library to a new project that I created on Android studio 3.0.1 as below, Gradle project sync is failed.
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
I am getting this errors;
Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.barteksc:android-pdf-viewer:2.0.3.
My gradle.build;
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "test.com.pdfviewer"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
}
Upvotes: 1
Views: 7480
Reputation: 3
Go to Setting then Gradle then unclick offline Work box. it works fine in my android studio 3.0
Upvotes: 0
Reputation: 1
how fix Error:
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.github.barteksc:android-pdf-viewer:2.8.2.
Upvotes: -1
Reputation: 665
Well i setup exact things which you mentioned at my end in Android Studio version 3.0.1 with implementation 'com.github.barteksc:android-pdf-viewer:2.0.3' and is working fine without any issues.
Else do one thing Go to File > Invalidate Caches / Restart and then try to open same project.
Upvotes: 0
Reputation: 69699
Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve
com.github.barteksc:android-pdf-viewer:2.0.3
ANS : You should use latest version of dependencies
Use this
compile 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.4'
OR if you want to use more stable version:
compile 'com.github.barteksc:android-pdf-viewer:2.8.2'
Instead of this
compile 'com.github.barteksc:android-pdf-viewer:2.0.3'
for more information check docs of com.github.barteksc:android-pdf-viewer
Upvotes: 2