【问题标题】:Failed to resolve: com.github.barteksc:android-pdf-viewer:3.2.0-beta.1 how to fix this无法解决:com.github.barteksc:android-pdf-viewer:3.2.0-beta.1 如何解决这个问题
【发布时间】:2022-06-23 05:21:57
【问题描述】:

我尝试构建android pdf阅读器并添加一个库com.github.barteksc:android-pdf-viewer:2.8.2然后它显示以下错误

我的 build.gradle 文件是请大家帮我解决问题,我想尽可能多地构建应用程序

请大家帮帮我

plugins {
    id 'com.android.application'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.dash.songuploader"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildToolsVersion '32.0.0'
}

dependencies {
    implementation 'com.karumi:dexter:6.2.3'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
//    implementation 'com.squareup.picasso:picasso:2.71828'

    //pdf library
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
    //dbshbs
    implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
//    implementation 'com.joanzapata.pdfview:android-pdfview:2.8.2@aar'
}

【问题讨论】:

  • 确保您没有开启离线模式。

标签: android gradle dependencies


【解决方案1】:

将 jcenter() 添加到 settings.gradle

【讨论】:

  • 对于那些不熟悉 settings.gradle 的人(比如我),这个文件会放在哪里?
【解决方案2】:

image for reference

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

将 jcenter() 添加到 settings.gradle

【讨论】:

    【解决方案3】:

    对于这个版本2.8.2,它只在 jCenter 上可用,但是如果你对 jCenter 有问题,你可以使用替代方案,比如 jitpack

    maven { url 'https://jitpack.io' }
    
    implementation 'com.github.barteksc:AndroidPdfViewer:master-SNAPSHOT'
    

    【讨论】:

      【解决方案4】:

      上面很多 cmets 都谈到了将 jcenter() 添加到 settings.gradle 中。

      这对我不起作用。为了让我的 Flutter 项目再次运行,我必须将 jcenter() 添加到 android/build.gradle 文件中。

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

      【讨论】:

        猜你喜欢
        • 2018-05-04
        • 2011-06-07
        • 2018-07-03
        • 2021-05-06
        • 2011-03-20
        • 1970-01-01
        • 1970-01-01
        • 2014-10-07
        • 1970-01-01
        相关资源
        最近更新 更多