Skip to content

Instantly share code, notes, and snippets.

@thekarthiksankar
Last active July 7, 2021 02:46
Show Gist options
  • Save thekarthiksankar/d4d68f5c2e4b44c25f4101a4742235b0 to your computer and use it in GitHub Desktop.
Save thekarthiksankar/d4d68f5c2e4b44c25f4101a4742235b0 to your computer and use it in GitHub Desktop.
Android: Import package from GitHub
// app level build.gradle
android {
def githubProperties = new Properties()
githubProperties.load(new FileInputStream(rootProject.file('github.properties')))
repositories {
maven {
name = "GitHubPackages"
/* Configure path to the library hosted on GitHub Packages Registry
* Replace GITHUB_ID with package owner userID and REPO_NAME with the repository name
* e.g. "https://maven.pkg.github.com/GITHUB_ID/REPO_NAME"*/
url = uri("https://maven.pkg.github.com/UserID/REPOSITORY")
credentials {
username = githubProperties['gpr.usr']
password = githubProperties['gpr.key']
}
}
}
}
dependencies {
// Include the dependency
implementation "packagename:modulename:version"
}
gpr.usr=GITHUB_USER_NAME
gpr.key=GITHUB_ACCESS_TOKEN
// Replace the GITHUB_USER_NAME & GITHUB_ACCESS_TOKEN with the respective values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment