Here's how to use Gradle to publish to Jcenter.
Register first to https://bintray.com to register an account. Configure accountwe need to configure two properties for Bintray_user and Bintray_key. Bintray_user is your registered account name, Bintray_key can be found in the following ways. , first click on your account name to enter the personal page. Then click Edit to go to the editing page. Then click on API Key, then click on the right side of show to see the API key.
Then go to your. Gradle directory (if you have not configured Gradle_user_home environment variables, it is in your user directory), edit gradle.properties (if not created), join the configuration:
- Bintray_user=xxx
- Bintray_key=xxx
Configuration Items Download My project: https://github.com/msdx/gradle-publish, copy the gradle.properties into your project, and configure the properties. Then refer to the build.gradle here to add to your build.gradle:
Buildscript { repositories { jcenter () } dependencies { classpath ' Com.jfrog.bintray.gradle: gradle-bintray-plugin:1.0 ' } }
Add one more sentence:
- Apply from: ' The relative path of your bintray.gradle '
Your bintray.gradle can refer to my project's bintray.gradle to write it. My bintray.gradle here is for the release of Android projects, the release of files including source code, documents and AAR, if you want to publish these, you can use directly. After the command is executed for release configuration, execution of Gradle Bintray is compiled, packaged, and published. Included in the Jcenter Central Library advanced into this page: Https://bintray.com/bintray/jcenter. Then click on the include My package, such as: then search for and tick your item in the popup dialog box. Then you can write your submission request (seemingly also can not write?) ), click "Send", then look at the administrator audit. Auditing waits for administrator approval. It's usually going to pass quickly. If you're impatient, you can declare your warehouse as Maven {URL http://dl.bintray.com/your user name/maven} before you approve it. Note: If you add this script and run the project in Android Studio, you will get an error, please comment on the "apply from" clause. The reason for the error is that it will not be able to find the task I packaged with AAR, but it is ok under the command line. If there is a better way to pack AAR, welcome to the exchange.
Publish Android Open source projects to Jcenter using Gradle