Android Open Source Library published to jcenter text and pits

Source: Internet
Author: User

I believe many people have used open source projects, especially after the popularity of Android studio, the use of open Source Library is more convenient and simple. And how to upload open Source Library to Jcenter for everyone to use, although there are tutorials on the web, but still met the pit, finally summed up, hope to help everyone.

"CSDN Address: http://blog.csdn.net/zhangke3016/article/details/52075159"
"This article simple book address: http://www.jianshu.com/p/0acf9e05b27e" Synchronous update

Androidstudio is downloading the class library from the Maven Repository server. There are basically jcenter and Maven central servers that are used to download the Android class library.
The code is configured as follows: Jcenter Warehouse

    {             repositories {                 jcenter()           }    }

Maven Central Warehouse:

{             repositories {                 mavenCentral()           }    }

First let's look at the meaning of the Gradle code written:

‘com.mrzk.loadingview:circleloadinglibrary:1.1.0‘

Its composition is this:

GROUP_ID:ARTIFACT_ID:VERSION

group_id refers to the Com.mrzk.loadingview, similar to the package name,artifact_id refers to the circleloadinglibrary, similar to the name of the class library; version is the 1.1.0, which is the revision number.

1. Register an account on bintray.com and log in.

2. After the registration is completed, create the warehouse

3. Create a warehouse

4. ADD New Package

5. Select the Androidstudio project to upload

6, set Bintray username and API key for Bintray encryption authentication

Write this information in the local.properties file. The reason for writing in Local.properties is that Bintray username and Apikey are sensitive private information that should be kept rather than uploaded to GitHub, just to local.properties files written in . Gitignore are filtered out and do not affect the uploaded GitHub project.

As follows:

bintray.user=YOUR_BINTRAY_USERNAMEbintray.apikey=YOUR_BINTRAY_API_KEY

Username is the username of your Bintray account.
Apikey here to find:

7. Configuring the Build.gradle file for the library module

ext{Bintrayrepo=' maven 'Bintrayname =' Circleloadinglibrary 'Publishedgroupid =' Com.mrzk.loadingview 'LibraryName =' Circleloadinglibrary 'Artifact =' Circleloadinglibrary 'Librarydescription =' a circle loading for Android 'SiteURL =' https://github.com/zhangke3016/CircleLoading 'Giturl =' Https://github.com/zhangke3016/CircleLoading.git 'Libraryversion =' 1.1.0 'Developerid =' Mrzk 'Developername =' Zhangke 'Developeremail =' 609975727@qq. com 'Licensename =' The Apache software License, Version 2.0 'Licenseurl =' Http://www.apache.org/licenses/LICENSE-2.0.txt 'Alllicenses = ["Apache-2.0"]}

The code we refer to this class library is:

‘com.mrzk.loadingview:circleloadinglibrary:1.1.0‘

8. Configure the relevant code for Bintray upload
Add the following two lines of code to the last line of the Build.gradle file:

from‘https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle‘from‘https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle‘

9. Add the last three lines of code throughout project Build.gradle

 dependencies {        ‘com.android.tools.build:gradle:2.0.0‘        ‘com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6‘        "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0"        ‘com.github.dcendents:android-maven-gradle-plugin:1.3‘    }

10. Execute the following command in the terminal window provided by Androidstudio

install

After a smooth word, it will appear:

BUILD SUCCESSFUL

The next step is to upload the successful file to Bintray:

gradlew bintrayUpload

When everything goes well, it will also appear:

BUILD SUCCESSFUL

Note that there is a pit here. I was in the build process, there is a problem of Javadoc generation failure, in the generation of Javadoc to check the correctness of the document, but the check here is a bit too strict, like
This kind of comment will cause the build to fail, and because of the use of Windows system, the default encoding is GBK, so in the upload compile times the encoding error problem.
Workaround:
In the build.gradle of the Library project, add:

{    tasks.withType(Javadoc) {        options.addStringOption(‘Xdoclint:none‘, ‘-quiet‘)        options.addStringOption(‘encoding‘, ‘UTF-8‘)    }}

11. Synchronize library files to the created Bintray warehouse

Click the Add to Jcenter button in the lower right corner

Skip to the page with Request to include the " test" in ' Jcenter ' and do nothing, just click on the Send button.

About 1 hours or so, Jcenter audit will receive a consent message on the Bintray. Congratulations, your class library has been uploaded to Jcenter successfully!

At this point, I write the class library circleloading, just need to add a line of code:

‘com.mrzk.loadingview:circleloadinglibrary:1.1.0‘

Finally,
circleloading introduction in my last blog, open source address: circleloading

Android Open Source Library published to jcenter text and pits

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.