Вы можете выполнить этот шаг за шагом, чтобы загрузить библиотеку Android. Нажмите здесь , чтобы проверить детали.Затем вы можете добавить его в файл build.gradle, чтобы использовать его.
Следуйте этому.
Шаг 1: Создайте учетную запись в Bintray с вашей учетной записью GitHub / Google Шаг 2: Сначала создайте репозиторийв вашем GitHub.Затем добавьте этот репозиторий в Bintray.Шаг 3: Откройте ваш библиотечный проект в Android Studio и добавьте следующую строку в файл build.gradle:
classpath 'com.novoda:bintray-release:{latest_version}'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha07'
// Step I: add this line
classpath 'com.novoda:bintray-release:0.8.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Шаг 4: Добавьте сведения о проекте в файл build.gradle в каталоге / app
apply plugin: ‘com.android.library’
publish {
def groupProjectID = '{package_name}'
def artifactProjectID = '{name_of_your_library}'
def publishVersionID = 'library_version_code'
userOrg = '{username_of_bintray}'
repoName = 'repository_name'
groupId = groupProjectID
artifactId = artifactProjectID
publishVersion = publishVersionID
desc = '{library description}'
website = '{github_url}
}
//Step I: Add the below line
apply plugin: 'com.novoda.bintray-release'
apply plugin: 'com.android.library'
//Step II: Add the below publish details
publish {
def groupProjectID = 'com.an.optimize'
def artifactProjectID = 'optimize'
def publishVersionID = '0.1.0'
userOrg = 'murthyanitaa'
repoName = 'Optimize'
groupId = groupProjectID
artifactId = artifactProjectID
publishVersion = publishVersionID
desc = 'Android library for displaying data based on JSON configuration fetched from server. With this library, you can kiss goodbye to string.xml, dimen.xml, arrays.xml. Keep all your string/integer/array config in one file. The library will automatically fetch the data from the url you provide.'
website = 'https://github.com/anitaa1990/Optimize'
}
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "android.arch.work:work-runtime:1.0.0-alpha01"
}
Шаг 5: Загрузка в Bintray: В терминале в Android Studio добавьте приведенную ниже команду для очистки, сборки и загрузки библиотеки в bintray:
gradle clean build bintrayUpload -PbintrayUser={userid_bintray} -PbintrayKey={apikey_bintray} -PdryRun=false
Шаг 6: Ссылка на JCenter: В репозитории вашего проекта в Bintray вы увидите свою библиотеку вместе с указанными вами сведениями о версии.Теперь все, что вам нужно сделать, это нажать Добавить в JCenter.