Android Development: How to publish the library in Android studio to Jcenter

Source: Internet
Author: User
Tags jcenter

I wrote a simple library before, I want to put on the jcenter. Have looked up all kinds of information. Stepping on all kinds of pits, have been a toss. Finally, a very easy and efficient method was found. Now share it, the method of my own self-test can be used, the realization of probably only half an hour. This method is written by a bull man abroad. I am here mainly to do a translation and finishing.

1 organize the module that needs to be published

Add this line of code to the top of the Build.gradle file of the library that needs to be published

‘https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle‘

Effect

Next, after the Apply plugin: ' Com.android.library ', add the following code, for example:

{    PUBLISH_GROUP_ID = ‘cn.weidongjian.android‘    PUBLISH_ARTIFACT_ID = ‘progress-button‘    PUBLISH_VERSION = ‘0.2‘}

publish_group_id fill in the name of the corresponding developer, publish_artifact_id fill in the name of the project, Publish_version fill in the project version number, but published to Jcenter after. Your compile address is:
PUBLISH_GROUP_ID:PUBLISH_ARTIFACT_ID:PUBLISH_VERSION
For example, my address for this project is:

‘cn.weidongjian.android:progress-button:0.2‘

Effects such as the following:

2 Generating a ZIP file

Open terminal and fill in this line of code. and then press ENTER

gradlew clean build generateRelease

Effect

After you click Enter, assume that you are building for the first time. Need to download the corresponding Gradle file, assuming the download fails, you need to FQ. When the download is complete, the zip file starts to build. There's going to be a lot of news, probably like this.

Finally, the zip file is successfully generated, and the address is f:\practise\progressbutton\progressbutton\build/release-0.2.zip. Move the zip file to the desktop and use it later.

3 Register Bintray account and set up warehouse

Enter Bintray, click on an account
Then click New Repository in the home page. Create a new warehouse

The warehouse name is written casually. type Remember to choose Maven, the following GPG and so on, do not tick

Then on the home page of the warehouse. Click on the Add New package

Generate a new package, the package name can choose to fill in the name of the library, license select Apache-2.0

Click Create Package to generate the package

4 build vertion and upload zip package

Go to the package page. Click New version to create a new version

Fill in the not information and then on the package page. Click New version. The name of my new version here is called Initialcommit. Go to version page

Then click Upload Files. Upload a previously generated zip package

Click to add files, add file, add file after successful. to select the Exploding the archive option

Then click Save Changes. The page will then prompt you to have several files that are not publish. You can click Publish to both

4 announced to Jcenter

Then go back to the package page. Then there is an add to Jcenter button in the lower right corner, click Apply to upload to Jcenter

Upload to Jcenter need to audit about two hours, after the audit will notify you by email. That's it. Then you'll be able to tell someone about your compile address. If you do not know the compile address, please see 1th

This approach is the simplest of the many methods I have tried. The basic oneself do not have to do special operation, follow step step to be able, hope to you have help, if have any question, welcome message, Thank you!

Android Development: How to publish the library in Android studio to Jcenter

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.