无法解析:com.github.barteksc:android-pdf-viewer:2.8.1

问题描述 投票:0回答:9

我正在尝试在我的项目中使用这个库。但我无法通过将其添加到 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.
}

构建.gradle

allprojects {
repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
   // google()  
   // mavenLocal() // tried everything
}
}

过去三天我几乎尝试了SO中给出的所有方法,但仍然找不到任何解决方案。即使我得到 jar 文件也会有帮助。

android android-gradle-plugin build.gradle pdf-viewer
9个回答
23
投票

只需将此行添加到build.gradle(应用程序级别)

implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'

如果您有 android studio bumblebeeandroid studio arctic Fox 那么,

gradlePluginPortal() 添加到 settings.gradle 文件

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

8
投票

你应该添加

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

6
投票

当他掉落时,这是 jCenter(已弃用)的问题。

添加:

allprojects {repositories {
        mavenCentral()
        google()
        gradlePluginPortal()
    }
}

3
投票

只需将此行添加到 build.gradle(应用程序级别)

实现“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.enableJetifier=true in gradle.properties

2
投票

确保将其添加到您的 allprojects 存储库中,就像在 android uild.gradle 文件中一样:不要忘记它应该使用 https://

进行 SSL 保护
repositories
   {
     maven {
        url ("https://jcenter.bintray.com")
     }
   }

1
投票

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

您可以打开互联网连接,让 Gradle 下载必要的依赖项...


1
投票

删除存储库下的任何其他 jcenter 定义

jcenter()

jcenter {
            url "http://jcenter.bintray.com/"
            allowInsecureProtocol = true
        }

然后将此行放在存储库部分下

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

0
投票
In my case, it's working with the beta version 
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'

 I added all the things they telling:

repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
And added this to gradle.properties on Gradle Scripts because I was having problems with duplicated classes -->
  android.useAndroidX=true
  android.enableJetifier=true

0
投票

第 1 步:我在 build.gradle(app) 的依赖项 {} 中添加了库的 beta 版本 - 如下所示:

dependencies {

    implementation ("com.github.barteksc:android-pdf-viewer:3.2.0-beta.1")
    
}

Step-2:我添加了 gradlePluginPortal() insise repositories{},如下所示:

repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }

Step-3:并在 Gradle 脚本上将

android.enableJetifier=true
添加到 gradle.properties,因为我遇到了重复类的问题

© www.soinside.com 2019 - 2024. All rights reserved.