【问题标题】:Problems with github dependency imagepickergithub依赖imagepicker的问题
【发布时间】:2021-08-08 20:52:18
【问题描述】:

大家好,这是我第一次在这里提问,但我曾经在检查这个网站时解决了很多问题。 有人能帮我吗 ?我想在我的画廊中选择一张图片并在我点击一个按钮时对其进行收费。为此,我在这里使用 github imagepciker 依赖项https://github.com/Dhaval2404/ImagePicker

我首先复制了 gradle 依赖项,现在我的 gradle 项目看起来像这样

由于我的声誉低于 10,我必须删除错误中的一些链接

    buildscript {
        repositories {
            google()
            maven { url "https://jitpack.io" }
            mavenCentral()
    
        }
        dependencies {
            classpath "com.android.tools.build:gradle:7.0.0"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
        }
    }

然后当我复制过去时 执行com.github.dhaval2404:imagepicker:2.1 或这个 执行com.github.dhaval2404:imagepicker-support:1.7.1 或两者兼有,我得到一个错误,它说

FAILURE: Build completed with 7 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.github.dhaval2404:imagepicker:2.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/dhaval2404/imagepicker/2.1/imagepicker-2.1.pom
       - https://repo.maven.apache.org/maven2/com/github/dhaval2404/imagepicker/2.1/imagepicker-2.1.pom
       - https://jcenter.bintray.com/com/github/dhaval2404/imagepicker/2.1/imagepicker-2.1.pom
     Required by:
         project :app

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

有人知道怎么解决吗?

【问题讨论】:

    标签: android kotlin gradle


    【解决方案1】:

    对我来说,我在 settings.gradle 文件中添加了以下代码

    dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soongoing to shut down soon
        maven { url 'https://jitpack.io' }
    }
    }
    

    【讨论】:

      【解决方案2】:

      由于您使用的是 kotlin ,因此您需要在 build.gradle (app) 中添加 androidx 依赖项

      即使用

      implementation 'com.github.dhaval2404:imagepicker-support:1.7.1'
      

      在您的应用级别 build.gradle 并且不要打扰项目级别的 gradle 文件

      【讨论】:

        猜你喜欢
        • 2021-10-24
        • 2012-05-23
        • 1970-01-01
        • 2022-07-28
        • 2021-10-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-02
        相关资源
        最近更新 更多