Android quick release project to jcenter

Android quick release project to jcenter

When I was organizing a project recently, I wanted to upload it to Jcenter so that everyone can import it with just one line of code. I searched online, but some methods online were too troublesome, so I wrote this article to record my sad experience, so that veterans can avoid detours and publish quickly. What's more annoying is that bintray has been revised recently, so now many people find that there is no Add to Jcenter button after uploading the code successfully. Oh my god, it's so annoying.

Now I will take you step by step to the road of becoming a great man, and to a happy and well-off life. This article intends to use the bintray-release plug-in recommended by Hongyang, which I personally feel is much more convenient than gradle-bintray-plugin.

Step 1: Apply for a Bintray account and obtain the required information (very important, read the steps carefully)

Why do you need to register this account? Because jcenter() belongs to a warehouse under bintray.

So you guys need a bintray account. Registration URL: https://bintray.com/

If you have come to this point, you have already made a mistake, unless you are an enterprise user or you wait for 30 days. Why? See the picture!

The registration address for the personal free version is https://bintray.com/signup/oss

Pay attention to the email issue: You cannot use QQ, 163, etc. If you use Github to log in quickly, you should also pay attention to the email issue.

Get information: After logging in, click your username in the upper right corner of the homepage to enter your personal homepage, then click Edit Profile under your username to enter your personal information editing page, then click the last item in the list on the left side of the page, API Key, and save it as you will need it later.

As shown in the figure, click the copy button indicated by the arrow on the far right to copy your API Key:

Step 2: Import bintray-release

First you should have a project to upload. I use one of my Android libraries to simulate a simple project. tobebetter is an Android library that is mainly used to store a digital clock. We are going to upload it to jcenter.

The project's build.gradle is introduced

Add bintray-release classpath to your project's build.gradle. Note that it is the project's build.gradle, not the module's, MyApplication3/build.gradle.

classpath 'com.novoda:bintray-release:0.3.4'

Configure the build.gralde of the module to be uploaded

Go to the module you want to upload, which is MyApplication3/tobebetter/build.gradle at the beginning of the article.

  1. apply plugin: 'com.novoda.bintray-release' //Add
  2.  
  3. //Add to
  4. publish {
  5. userOrg = 'shantecnology' //bintray.com user name
  6. groupId = 'com.halloandroid' // path on jcenter
  7. artifactId = 'tobebetter' //Project name
  8. publishVersion = '1.0.0' //version number
  9. desc = 'this is for test' // description, not important
  10. website = 'https://github.com/shanlovana/tobebetter' //Website, preferably, not important
  11. }

Just follow the picture to know how to write it. The details are annotated. Assuming that it is written as above and uploaded successfully, the final way to introduce your project is:

  1. compile 'com.halloandroid:tobebetter:1.0.0

After completing the above configuration, we are ready to upload.

Upload code to Bintray

Uploading is very simple. Just run the following code in the Terminal panel of Android Studio:

Windows:

  1. gradlew clean build bintrayUpload
  2. -PbintrayUser=shantecnology
  3. -PbintrayKey=xxxxxxxxxxxxxxxxxxxxxxxx
  4. -PdryRun= false  

Mac:

  1. ./gradlew clean build bintrayUpload
  2. -PbintrayUser=shantecnology
  3. -PbintrayKey=xxxxxxxxxxxxxxxxxxxxxxxx
  4. -PdryRun= false  

user is the user name, key is the Api key we just mentioned, dryRun is a configuration parameter. When it is true, all links will be run, but no uploading will be done.

Then just wait. When the running and uploading is complete, and you see BUILD SUCCESSFUL, then there is no problem. If there is a problem, check it according to the log.

The upload is now complete, isn't it fast?

Enter our uploaded space and you will see our project, for example, the address I just uploaded is: https://bintray.com/shantecnology/maven

The address you uploaded is: https://bintray.com/your username/maven

When submitting, please provide a brief description in English and try not to use Chinese.

The tutorial ends here, but you cannot directly reference it at present. You need to wait for the review by bintray staff. If the review is passed, you will receive a message on the site, which will take about two hours, and the Add to Jcenter button will disappear.

Note:

Garbled code problem:

If there is Chinese in the comment, you may see: Unmappable characters in GBK encoding

1. Add to the project's build.gradle:

  1. allprojects {
  2. tasks.withType(Javadoc) {
  3. options{
  4. encoding "UTF-8"  
  5. charSet 'UTF-8'  
  6. links "http://docs.oracle.com/javase/7/docs/api"  
  7. }
  8. }
  9. }

2. Actually, I think the Chinese annotations can be changed into English. After all, we are men who want to be big men, you know! Baidu Translate, Bing Translate...

Version Update

After we upload, we will definitely have to deal with the update issue. So how to update?

  1. publish {
  2. userOrg = 'shantecnology' //bintray.com user name
  3. groupId = 'com.halloandroid' // path on jcenter
  4. artifactId = 'tobebetter' //Project name
  5. publishVersion = '2.0.0' //version number
  6. desc = 'this is for test' // description, not important
  7. website = 'https://github.com/shanlovana/tobebetter' //Website, preferably, not important
  8. }

Most of them don't need to be changed, just modify the version number. After the modification is completed, execute the upload code. After the upload is completed, click the button in the picture below. The update review is relatively fast, so just wait a moment.

<<:  Android development: from modularization to componentization (Part 1)

>>:  Do you understand 50% of alloc and init?

Recommend

How hard are teeth? Should wisdom teeth be extracted?

Have good teeth Not only can it make you smile En...

Community Operation: How to increase community interaction efficiency by 500%?

The theme of this session is to share how to incr...

Using this method, promotion costs can be reduced by 50%!

When doing marketing promotion or researching use...

Would you like to know the 10 tips for Weibo operation and promotion?

Would you like to know about the ten tips for Wei...

[One Belt, One Road Story] The "pioneers" heading towards the sun

"A lone smoke rises straight in the desert, ...

Gold is just a metal. It cannot be eaten or worn. Why is it so valuable?

What is gold? Gold is a symbol of wealth, a fine ...

The most effective way to promote Xiaohongshu: product promotion!

The most common and effective promotion method of...

Tik Tok Teacher Yu Yinuo's textbook unit synchronized composition class

Introduction to the resources of the textbook uni...

Android Network--How I did it: Volley+OkHttp+Https

Use OkHttp as the transport layer implementation....

How to promote a new App?

Since I often write about App promotion, friends o...

Marketing strategy for Labor Day!

The 2021 May Day is approaching. As one of the mo...