Search code examples
android-studiokotlingradlejitpack

Can't use Jitpack dependencies


Trying to use ImagePicker from Jitpack however it won't import into my code even after following the adding dependency steps.

settings.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'

build.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 not being imported correctly: image of error

Also tried removing the repos from settings.gradle and adding it to build.gradle like this:

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

but still having the same issue


Solution

  • Firs of all you need to declare version of this library. Change

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

    to specified version tag like implementation 'com.github.dhaval2404:imagepicker:2.1'.

    Then you could delete

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

    form build.gradle.