You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法导入jaydeepw/poly-picker库:报错Failed to resolve: com.github.jaydeepw:poly-picker:1.0.23

解决无法导入poly-picker库的依赖解析问题

看起来你在导入jaydeepw/poly-picker库时碰到了依赖解析失败的问题,我来帮你一步步排查解决。

你的问题场景

报错信息:Failed to resolve: com.github.jaydeepw:poly-picker:1.0.23
你的模块级build.gradle内容如下:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.example.sharaddadhich.multipleimages_camera"
        minSdkVersion 17
        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'
        }
    }
}
repositories{
    maven { url "https://maven.google.com" }
    maven { url 'https://repo.commonsware.com.s3.amazonaws.com' }
    maven { url 'https://jitpack.io' }
    maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    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:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.github.jaydeepw:poly-picker:1.0.23'
    testCompile 'junit:junit:4.12'
}

分步解决方案

  1. 确认根目录build.gradle的仓库配置
    很多人容易忽略根目录的仓库设置,JitPack仓库需要在根目录的allprojects块中声明,这样所有模块都能访问到。修改根目录build.gradle的相关部分:

    allprojects {
        repositories {
            google()
            mavenCentral() // 如果你用的是较新Gradle版本,jcenter已废弃,建议改用mavenCentral
            maven { url "https://jitpack.io" }
        }
    }
    
  2. 清理模块级配置中的重复项
    你的模块repositories里有两个重复的commonsware仓库地址,虽然不直接导致问题,但冗余配置可能引发意外,建议删除重复项:

    repositories{
        maven { url "https://maven.google.com" }
        maven { url 'https://repo.commonsware.com.s3.amazonaws.com' }
        maven { url 'https://jitpack.io' }
    }
    
  3. 更新依赖关键字(可选但推荐)
    新版Gradle已经弃用了compile关键字,改用implementation,虽然这不是你当前问题的根源,但为了代码规范和后续兼容性,建议替换:

    implementation 'com.github.jaydeepw:poly-picker:1.0.23'
    
  4. 重建项目并同步Gradle

    • 点击Android Studio右上角的Sync Now按钮,同步最新的Gradle配置
    • 执行Build > Clean Project清理旧缓存,再执行Build > Rebuild Project重新构建整个项目
  5. 检查网络访问
    确保你的开发环境可以正常连接JitPack仓库,如果处于受限网络环境,可能需要配置代理或者切换到稳定的网络。

内容的提问来源于stack exchange,提问作者Sharad Dadhich

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:33:44