我正在尝试在我的项目中使用这个库。但是我无法通过将其添加到 gradle build 中来下载它。事实上,我什至无法通过 gradle 下载任何库。我需要手动下载一个 jar 文件并将其添加为库。但在这种情况下,我找不到 PDFviewer 的 jar 文件。
Build.gradle(模块)
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
}
}
在过去的三天里,我几乎尝试了 SO 中给出的所有方法,但仍然找不到任何解决方案。即使我得到了 jar 文件,它也会有所帮助。
最佳答案
只需将这一行添加到 build.gradle(app level)
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
如果你有 android studio bumblebee 或 android studio arctic fox 那么,
将gradlePluginPortal()添加到settings.gradle文件
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
关于android - 无法解析 : com. github.barteksc :android-pdf-viewer:2. 8.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47405710/