Use Gradle to publish an open-source Android project to JCenter and gradlejcenter
I believe many people want to publish their projects to a public central repository, such as maven central repository, for easy integration and use by others. Those who use Android Studio should also be impressed with gradle and jcenter. Many open-source libraries are released here. This article mainly introduces how to use Gradle to publish to jcenter.
This article is original.
Reprinted, please indicate the source of the CSDN blog:
Http://blog.csdn.net/maosidiaoxian/article/details/43148643
Register an account first in https://bintray.com.
To configure an account, we need to configure two attributes: BINTRAY_USER and BINTRAY_KEY. BINTRAY_USER is the name of your registered account. You can find BINTRAY_KEY using the following methods ., Click your account name to go to the personal page.
Click Edit to go to the editing page.
Click the API key, and click Show on the right to view the api key.
Download my configuration Project: Development.
Then refer to the build. gradle here and add the following to your build. gradle:
buildscript { repositories { jcenter() } dependencies { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' }}
Add the following sentence:
Apply from: 'relative path of your bintray. gradle'
The reason why http: // xxxx is not used here is that the file is first released for the android project, and then the project may be updated later.
You can refer to this document for your bintray. gradle. Here, bintray. gradle is used to publish android projects. The released files include the source code, documents, and AAR.
After you execute the command to complete the release configuration, execute gradle bintray to compile, package, and release it.
Review is pending for Administrator review. It is usually very quick to pass. If you are in a hurry, you can declare your repository by using maven {url http://dl.bintray.com/your user name /maven.
Note: if an error occurs when running the project in android studio after the script is added, please note the sentence "apply from. The error occurs because it cannot find the task where I packed the aar package, but it works in the command line. If you have a better way to package aar, please contact us.