Skip to content

Instantly share code, notes, and snippets.

@levibostian
Created June 14, 2021 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levibostian/c6c83025761c0bc27cf16734fae5ac57 to your computer and use it in GitHub Desktop.
Save levibostian/c6c83025761c0bc27cf16734fae5ac57 to your computer and use it in GitHub Desktop.
Install Android SDK from private github repo in your Android app
// this file is in app/build.gradle
...
dependencies {
// Install your library
implementation 'com.example.lib:sdk:0.1.1-alpha'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.32"
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
subprojects {
// Load `secrets.properties` file, if it exists.
if (file("$project.rootDir/secrets.properties").exists()) {
def localProperties = new Properties()
localProperties.load(new FileInputStream("$project.rootDir/secrets.properties"))
localProperties.each { prop ->
project.ext.set(prop.key, prop.value)
}
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/yourusername/repo-name")
credentials {
username = project.ext.find("githubRepo.username") ?: System.getenv("GITHUB_REPO_USERNAME")
password = project.ext.find("githubRepo.token") ?: System.getenv("GITHUB_REPO_TOKEN")
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
githubRepo.username=your-github-username
githubRepo.token=XXXXXXXXXXXXXXXXXXX
# On CI server, set: GITHUB_REPO_USERNAME and GITHUB_REPO_TOKEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment