datatrans / android-sdk

Accept payments on your Android apps: Our mobile SDKs support your entire payment and registration process and simplify the integration of any payment method in your mobile apps.
Other
6 stars 0 forks source link

Failed to resolve: ch.datatrans:android-sdk:3.3.0 #17

Closed Jean-PhilippeDESCAMPS closed 11 months ago

Jean-PhilippeDESCAMPS commented 11 months ago

Hello,

I'm currently working to integrate your SDK in my project. I have follow your documentation at https://docs.pci-proxy.com/docs/mobile-sdks-quick-start#android When I build project with gradle my project compiles correctly but I have a warning : Failed to resolve: ch.datatrans:android-sdk:3.3.0 I used this url : 'https://datatrans.jfrog.io/artifactory/mobile-sdk/'

What's wrong with my integration ?

luiscosta commented 11 months ago

Hello,

As I have more than one project, I have something like this on my project's build.gradle:

allprojects {
    repositories {
        (...)
        maven {
            setUrl("https://datatrans.jfrog.io/ui/native/mobile-sdk/")
        }
        (...)
    }
}

Additionally you can also declare it like: maven(url = "https://datatrans.jfrog.io/ui/native/mobile-sdk/")

Do you have something like this?

Jean-PhilippeDESCAMPS commented 11 months ago

If I use maven(url = "https://datatrans.jfrog.io/ui/native/mobile-sdk/") I have an error > Could not set unknown property 'url' for repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

here is my gradle file

buildscript {
    repositories {
        google()
        maven {
            url 'https://datatrans.jfrog.io/artifactory/mobile-sdk/'
        }
    }

    dependencies {
        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.42'
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.7.4"
    }
}

plugins {
    id 'com.android.application' version '8.0.0' apply false
    id 'com.android.library' version '8.0.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
luiscosta commented 11 months ago

The maven of the Datatrans should be on something like:

buildscript {
    repositories {
        google()
    }

    dependencies {
        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.42'
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.7.4"
    }
}

// OUTSIDE OF BUILDSCRIPT 
// UNDER THE MODULE REPOSITORIES
project(<path to your module>) {
    repositories {
        maven {
            setUrl("https://datatrans.jfrog.io/ui/native/mobile-sdk/")
        }
    }
}

// OR IF YOU HAVE MORE THAN ONE LIKE ME:

allProjects {
    repositories {
        maven {
            setUrl("https://datatrans.jfrog.io/ui/native/mobile-sdk/")
        }
    }
}

plugins {
    id 'com.android.application' version '8.0.0' apply false
    id 'com.android.library' version '8.0.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Jean-PhilippeDESCAMPS commented 11 months ago

If I had allProjects {} gradle return an error only buildscript {}, pluginManagement {} and other plugins {} script blocks are allowed before plugins {} blocks, no other statements are allowed

Jean-PhilippeDESCAMPS commented 11 months ago

I have a settings.gradle

pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "MyApp"
include ':app'

I have tried to add maven url in there and it's not resolved.

Jean-PhilippeDESCAMPS commented 11 months ago

@luiscosta, is it a problem with my configuration ?

luiscosta commented 11 months ago

if you have a settings.gradle like that then the maven of the Datatrans should be at:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://datatrans.jfrog.io/artifactory/mobile-sdk/' }
    }
}

and not on the other file as I previously mentioned.

Jean-PhilippeDESCAMPS commented 11 months ago

Perfect, it's working then. Thanks for you time.

luiscosta commented 11 months ago

Perfect!!