0

尝试使用来自 Jitpack 的 ImagePicker,但是即使按照添加依赖项步骤,它也不会导入到我的代码中。

设置.gradle

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
    google()
    mavenCentral()
    jcenter() // Warning: this repository is going to shut down soon
    maven { url "https://jitpack.io" }
}
}
rootProject.name = "Flower Identifier v1"
include ':app'

构建.gradle

dependencies {

implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.github.jkwiecien:EasyImage:Tag'
implementation 'com.github.Dhaval2404:ImagePicker:Tag'
}

ImagePicker 未正确导入: 错误图片

还尝试从 settings.gradle 中删除 repos 并将其添加到 build.gradle 中,如下所示:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

但仍然有同样的问题

4

1 回答 1

1

首先你需要声明这个库的版本。改变

implementation 'com.github.jkwiecien:EasyImage:Tag'
implementation 'com.github.Dhaval2404:ImagePicker:Tag'

到指定的版本标签,如implementation 'com.github.dhaval2404:imagepicker:2.1'.

然后你可以删除

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

表格build.gradle

于 2021-09-21T11:45:45.473 回答