Adding Required Repositories to your Project

Add all required repositories including the local Maven repository to your project by modifying the app module build.gradle file for your project.

From Android Studio, open the top-level build.gradle file and add the following to all the repositories blocks:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
buildscript {
    repositories {
        google()
        jcenter()
        mavenLocal()
    }
}
allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
    }
}

Alternatively, we offer a better similar to well-known public repositories such as Maven Central, Bintray and JCenter: The SAP Cloud Shipment channel. In this very specific case of the Android SDK, we are talking about a customer-facing Maven repository that you can configure in your projects to consume the Cloud Platform SDK for Android without any additional manual downloads. We finally publish Android SDK libraries via SAP-hosted Maven infrastructure in the DMZ. The process to use this is:

  • Obtain a technical user from the SAP Repositories Management site, and download the Basic Auth Password file. See Creating Required Credentials for further details.
  • Set the user credentials in ENV (SAP_MAVEN_USER, SAP_MAVEN_PASSWORD)
  • Create a $HOME/.gradle/init.gradle script with the following contents:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
allprojects {
     ext.SAPRepoConfig = {
         maven {
             url "https://73555000100900002360.maven.repositories.sapcdn.io"
             credentials {
                 username "$System.env.SAP_MAVEN_USER"
                 password "$System.env.SAP_MAVEN_PASSWORD"
             }
         }
     }
     buildscript.repositories SAPRepoConfig
     repositories SAPRepoConfig
 }
Now all Android projects will also fetch dependencies from SAP infrastructure.

Note

You can add the above Maven project to your project repositories in the app module build.gradle file, the above settings can be maintained on the project level.