Search code examples
androidpaypal-android-sdk

I'm trying to the correct dependencies for paypal but I get a ':app:debugRuntimeClasspath' error


I'm following the "https://developer.paypal.com/docs/checkout/advanced/android/" to add the correct dependencies to use paypal in my jetpack compose android app, but i get this error: "Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'."

Everything was going great before I started to play in the build.gradle files.

I added theses lines of code in my build.gradle app file:

    implementation("com.paypal.android:card-payments:CURRENT-VERSION-SNAPSHOT")
    implementation("com.paypal.sdk:paypal-android-sdk:2.16.0")

and I did what the paypal website said for the project build.gradle file but I received this error "Build file 'C:\Users\FookY\AndroidStudioProjects\PaymentProcessing\build.gradle.kts' line: 9

Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'build.gradle.kts' " so I changed my settings.gradle file to this:

pluginManagement {
    repositories {
        google {
            content {
                includeGroupByRegex("com\\.android.*")
                includeGroupByRegex("com\\.google.*")
                includeGroupByRegex("androidx.*")
            }
        }
        mavenCentral()
        gradlePluginPortal()
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven("https://oss.sonatype.org/content/repositories/snapshots/")
    }
}

rootProject.name = "PaymentProcessing"
include(":app")

and now I get this error

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

i only want to get the dependencies straighten out so I can use the paypal sdk. How can I achieve this?


Solution

  • One shouldn't copy and paste this literally:

    implementation "com.paypal.android:card-payments:CURRENT-VERSION-SNAPSHOT"
    

    That obviously should rather be:

    implementation "com.paypal.android:card-payments:1.5.0"
    

    Using version 1.5.0-SNAPSHOT is neither required nor recommended.

    https://mvnrepository.com/artifact/com.paypal.android/card-payments