【问题标题】:Failed to resolve: com.github.barteksc:android-pdf-viewer:2.8.1无法解决:com.github.barteksc:android-pdf-viewer:2.8.1
【发布时间】:2018-05-04 11:32:09
【问题描述】:

我正在尝试在我的项目中使用这个库。但是我无法通过将其添加到 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 文件也会很有帮助。

【问题讨论】:

  • 你能提供日志吗?
  • 顺便说一下compile fileTree(include: ['*.jar'], dir: 'libs') 已经编译库中的所有JAR文件
  • 但我无法获得这个特定的库。 @cricket_007
  • 我知道。只需指出compile files('libs/*.jar') 是不必要的
  • 嘿@IntelliJAmiya,您的回答有效。我只是犯了一个偶然的错误。像这样匆忙粘贴`maven { maven { url "jcenter.bintray.com" } }`非常感谢!

标签: android android-gradle-plugin build.gradle pdf-viewer


【解决方案1】:

确保在 android\build.gradle 文件中将其添加到您的 allprojects 存储库中:不要忘记它应该使用 https:// 进行 SSL 保护

repositories
   {
     maven {
        url ("https://jcenter.bintray.com")
     }
   }

【讨论】:

    【解决方案2】:

    添加 maven URL 和 GitHub 依赖项...

    您可以打开 Internet 连接以供 Gradle 下载必要的依赖项...

    【讨论】:

      【解决方案3】:

      你应该添加

      repositories 
         {
            maven { url "http://jcenter.bintray.com" }
         }
      

      【讨论】:

      • 我收到此错误Error:You must specify a URL for a Maven repository. 我的 AS 版本是 2.2.3
      • jcenter() 是一样的,不是吗?
      • 成功了! @IntelliJ 阿米娅
      猜你喜欢
      • 2022-06-23
      • 2018-07-03
      • 2022-12-11
      • 2017-10-25
      • 2021-12-27
      • 1970-01-01
      • 2019-11-10
      • 1970-01-01
      • 2021-01-01
      相关资源
      最近更新 更多