I am trying to work with TapAndPay private SDK and...
# gradle
z
I am trying to work with TapAndPay private SDK and going by the documentation. I have added this:
Copy code
allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url "file:/users/ziv.kesten" } // Local path to the folder into which you unzipped the SDK
    }
}
To my project gradle file, Anf that:
Copy code
dependencies {
    implementation 'com.google.android.gms:play-services-tapandpay:17.1.2'
}
To my grade.bulld But i fail due to
Copy code
Unable to resolve dependency for ':lemonade@staging/compileClasspath': Could not resolve com.google.android.gms:play-services-tapandpay:17.1.2.
Anyone knows what am i doing wrong?
c
What's the folder structure inside
/users/ziv.kesten
?
c
the mechanism for defining a file repository is:
Copy code
repositories {
   flatDir {
       dirs 'D:/path/to/local/directory'
   }
}
or, alternately, directly do this with no repository definition:
Copy code
dependencies {
    compile files('/path/to/dir/something_local.jar')
}
c
That's only if it's a single jar file. I guess the SDK over here from google includes “dependencies” to other libraries.
So the folder structure should map to a maven repository.
c
there is no mechanism in gradle to have a file-based repository (the above mechanism expect files/jars, not Maven coordinates). Is there no proper Maven repository? The closest file-based mechanism would be to add these to mavenLocal repository, somewhow…
c
Sure there is. mavenlocal is just a shourtcut that maps to “file:~/.m2”.
You can define anything you want as a maven repository as long as the folder structure is correct. And you have the Pom file at the correct folder
c
mavenLocal is a special type of `DefaultMavenLocalArtifactRepository`to allow it to look like a Maven Repository; without using Gradle internals, not aware of a way to create your own equivalent, as all the dependency specification mechanisms require either coordinates or, or file-repositories (flatDir), the JAR file names.
c
With maven cli you would do something like this
mvn -Dmaven.repo.local=/my/local/repository/path
c
is the supplied SDK structured as a Maven repo? If so you could manually add to ~/.m2
c
this will be a maven coordinate of “com.cmgapps.android:lint-nullify”. so if you define a “file:” url with that folder structure and the according meta and pom files, you can use anything as a repository
@ziv kesten according to stackoverflow you need to extend the path to map to
Copy code
file:/*pathto*/sdk/extras/google/m2repository/
https://stackoverflow.com/questions/68982591/failed-to-resolve-tapandpay-dependency-in-local
z
Yes, it wasn't enough to just indicate where I unzipped the SDK, I had to unzip it to that specific location, the documentation was a bit misleading on that. thank you everyone!
👍 1
940 Views