Skip to content

Instantly share code, notes, and snippets.

@skgmn
Last active January 18, 2024 08:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skgmn/79da4a935e904078491e932bd5b327c7 to your computer and use it in GitHub Desktop.
Save skgmn/79da4a935e904078491e932bd5b327c7 to your computer and use it in GitHub Desktop.
Step by step to use Android library which has been published to GitHub Packages.
  1. Go to [Your Profile] => [Developer settings] => [Personal access token] => [Generate new token] on github.com
  2. Check read:packages
  3. Click Generate token
  4. Copy the generated token
  5. Add below lines to your ~/.gradle/gradle.properties (the path may be different on Windows)
GITHUB_ID={your github id}
GITHUB_PACKAGES_TOKEN={the generated token}
  1. Merge below lines to your <project root>/settings.gradle (If you are using the recent version of Android Gradle Plugin)
dependencyResolutionManagement {
    repositories {
        maven {
            url "https://maven.pkg.github.com/skgmn/*"
            credentials {
                username GITHUB_ID
                password GITHUB_PACKAGES_TOKEN
            }
        }
    }
}

or to your <project root>/build.gradle

allprojects {
    repositories {
        maven {
            url "https://maven.pkg.github.com/skgmn/*"
            credentials {
                username GITHUB_ID
                password GITHUB_PACKAGES_TOKEN
            }
        }
    }
}
  1. Finally add an artifact to use to your <project root>/app/build.gradle
dependencies {
    implementation "com.github.skgmn:viewmodelevent:1.0.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment