0

In my application I am working on play-services-tapandpay. With the help of following link, adding dependency in local I am able to run the code smoothly in local.

Now the problem is I am creating production apk to deploy in play store, where I am not getting idea how to access "play-services-tapandpay" dependency which was placed in local.

I did not find any artifactory repository to access it from server.

Can anyone let me know how to access that local dependency file from server.

user2384424
  • 187
  • 1
  • 3
  • 13

1 Answers1

1

You have several options to try:

Option 1 - Server with admin access

If you have admin access to the server you could copy the play-services-tapandpay folder to the server and refer to it in you gradle file (just like you did locally):

maven { url "file:*your server absolute path here*"}

Option 2 - AAR in the libs folder

You could put the play-services-tapandpay-x.y.z.aar file in your project libs folder and ensure you have the following in your build.gradle file:

dependencies {
    ...
    implementation fileTree(include: ['*.aar'], dir: 'libs')
    ...
}

You should also manually add all the dependencies from play-services-tapandpay-x.y.z.pom to your build.gradle.

Option 3 - Upload the files to a private Nexus Maven repository

The files you are required to upload are: maven-metadata.xml, aar and pom.

You could use the UI or if you prefer the command line, these should be the commands:

curl -v -u $USERNAME:$PASSWORD \
--upload-file com/google/android/gms/play-services-tapandpay/maven-metadata.xml \
http://your.private.repository/repository/maven2-release-hosted/com/google/android/gms/play-services-tapandpay/maven-metadata.xml

curl -v -u $USERNAME:$PASSWORD \
--upload-file com/google/android/gms/play-services-tapandpay/x.y.z/play-services-tapandpay-x.y.z.pom \
http://your.private.repository/repository/maven2-release-hosted/com/google/android/gms/play-services-tapandpay/x.y.z/play-services-tapandpay-x.y.z.pom

curl -v -u $USERNAME:$PASSWORD \
--upload-file com/google/android/gms/play-services-tapandpay/x.y.z/play-services-tapandpay-x.y.z.aar \
http://your.private.repository/repository/maven2-release-hosted/com/google/android/gms/play-services-tapandpay/x.y.z/play-services-tapandpay-x.y.z.aar

Reference: https://support.sonatype.com/hc/en-us/articles/115006744008

Then in your settings.gradle you need to add your private Maven repository:

maven {
    url("http://your.private.repository/repository/maven2-group")
    allowInsecureProtocol(true)
    credentials {
        username("$System.env.USERNAME")
        password("$System.env.PASSWORD")
    }
}

Finally, you can use the dependency in you build.gradle:

implementation "com.google.android.gms:play-services-tapandpay:x.y.z"

fernandospr
  • 2,976
  • 2
  • 22
  • 43