Home > Mobile >  Failed to add dependencies in gradle
Failed to add dependencies in gradle

Time:04-05

I'm learning to build android app in Java, and I want to implement tinder swipe card in my android project. I found CardStackView at https://github.com/yuyakaido/CardStackView and I want to use it. But I can't add the dependencies in my build.gradle. Here's my build.gradle file:

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.appname"
        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
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.annotation:annotation:1.3.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
    implementation 'com.google.android.material:material:1.6.0-alpha03'
    implementation 'com.google.android.gms:play-services-base:18.0.1'
    implementation 'com.github.Cutta:GifView:1.4'
    implementation 'com.google.firebase:firebase-database:20.0.4'
    implementation 'com.google.firebase:firebase-auth:21.0.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.navigation:navigation-fragment:2.4.1'
    implementation 'androidx.navigation:navigation-ui:2.4.1'

    implementation 'com.yuyakaido.android:card-stack-view:2.3.4'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

and here's the error message that I always get:

Could not find com.yuyakaido.android:card-stack-view:2.3.4.
Required by:
    project :app

I've tried to use double quotes, clean and rebuild the project, as well as restarting my android studio. Yet I can't solve this problem. Am I missing something? Thanks in advance.

CodePudding user response:

This library use JCenter. But the JCenter is deprecated, so it will not in your gradle.build. Please add JCenter to your gradle.build.

Or use JitPack repository. Refer here

  • Related