Android uploads the library to Jcenter ultra-simple complete steps and encounters with various pits

Source: Internet
Author: User

Android uploads the library to Jcenter ultra-simple complete steps and encounters with various pits

In the "Play The SQLite series" (vii) to create a lightweight ORM tool class Sqlitedbutil operations database
We can see the super-concise usage of this tool class: it only needs to be introduced in Gradle:

‘cn.bluemobi.dylan:sqlitelibrary:0.1‘

Can be used, so what's going on here? This is a remote repository for Android project Jcenter. All we need to do is upload your libray to Jcenter, so what about uploading a project to Jcenter?

1. Go to Jcenter website to register an account: https://bintray.com

Registration interface such as:

2. Add a configuration to Build.gradle (project) in the root directory

Add the following configuration in the location as

        ‘com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2‘        ‘com.github.dcendents:android-maven-gradle-plugin:1.5‘

3. Add the following configuration to the Build.gradle of the module you want to upload

Add the following configuration in the location as follows: There is a detailed comment in the configuration.

/** The following is the relevant configuration for uploading the Android library to Jcenter **/Apply plugin:' Com.github.dcendents.android-maven 'Apply plugin:' Com.jfrog.bintray '//Project HomedefSiteURL =' Https://github.com/linglongxin24/SQLite '    //Project homepage//version control address of projectdefGiturl =' Https://github.com/linglongxin24/SQLite.git ' //Project Git//Publish to organization name name, must fill inGroup ="Cn.bluemobi.dylan"//Publish to Jcenter on the project name, must fill indefLibname ="Androidfastdevframe"//version number, the next update is only required to change the version numberVersion ="1.0"/** The compilation path after the above configuration is uploaded to Jcenter: Compile ' cn.bluemobi.dylan:sqlitelibrary:1.0 ' **///Generate source FilesTask Sourcesjar (type: Jar) {from android.sourceSets.main.java.srcDirs classifier =' Sources '}//Generate DocumentsTask Javadoc (type: Javadoc) {Source = Android.sourceSets.main.java.srcDirs Classpath + = Project.files (Android.getbootclasspath (). Joi N (file.pathseparator)) options.encoding"UTF-8"Options.charset' UTF-8 'Options.authortrueOptions.versiontrueOptions.links"Https://github.com/linglongxin24/FastDev/tree/master/mylibrary/docs/javadoc"FailOnErrorfalse}//Document packaged as JarTask Javadocjar (type: Jar, Dependson:javadoc) {classifier =' Javadoc 'From Javadoc.destinationdir}//Copy Javadoc fileTask Copydoc (type: Copy) {from"${builddir}/docs/"Into"Docs"}//Upload the required source files to the JcenterArtifacts {Archives Javadocjar Archives Sourcesjar}//Configure MAVEN library to generate Pom.xml filesInstall {repositories.maveninstaller {//This generates pom.xml with proper parametersPom {Project {packaging' AAR 'Name' This is a lightweight SQLite database framework 'URL SiteURL licenses {license {name' This is a lightweight SQLite database framework 'Url' Https://github.com/linglongxin24/SQLite '}} developers {developer {ID' Linglongxin24 'Name' Dylan 'Email' [email protected] '}} SCM {connection Giturl developerconnection Giturl URL SiteURL}}}}//upload to JcenterProperties Properties =NewProperties () properties.load (Project.rootProject.file (' Local.properties '). Newdatainputstream ()) bintray {user = Properties.getproperty ("Bintray.user")//Read the Bintray.user inside the local.properties fileKey = Properties.getproperty ("Bintray.apikey")//Read the Bintray.apikey inside the local.properties fileconfigurations = [' Archives '] pkg {repo ="maven"Name = Libname//Publish to Jcenter on the project name, must fill indesc =' This is a lightweight SQLite database framework '    //Project DescriptionWebsiteurl = SiteURL Vcsurl = Giturl licenses = ["Apache-2.0"] Publish =true}
4. Add the user name and API Key to the local.properties of your project's root directory

Find your own apikey in the location: Login to Jcenter->edit profile->api Key


Add the following configuration in the location as

gradle
bintray.user=linglongxin24
bintray.apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

5. Execution of commands
    • (1) Pom files required to generate the MAVEN library: Graedlew Install
install


If you see build successful the Pom file has been generated successfully, and you can see the jar package files for Javadoc and Javasource in the project view of your Android studio

    • (2) Upload your library to Jcenter's maven library: Graedlew bintrayupload
graedlew bintrayUpload

If you see build successful, your library has been successfully uploaded to the Jcenter maven library.

6. View the uploaded Maven library and submit an audit

Login Jcenter Home---click maven below to access your uploaded MAVEN Library list interface

Find you in the MAVEN Library list interface You just uploaded the Maven library point in to see the relevant project details

At the bottom of the MAVEN Library details page you upload, you can see the following: Add to Jcenter button

Click the Add to Jcenter button to complete the item description to submit. This site is maintained abroad, due to the reasons for the time difference they usually work in our evening, wait until the next day to pass the audit

Review the approved interface the next day

7. The various pits and solutions encountered
    • (1) Pit One: Error: Encoding GBK non-mapped characters, please configure Javadoc encoding correctly
java//生成文档       task javadoc(type: Javadoc) {           options.encoding "UTF-8"           options.charSet ‘UTF-8‘       }
    • (2) Pit II: Error: Do not allow self-closing elements, please delete all the HTML tags inside the Javadoc comment.

    • (3) Pit three: Error: Package android.support.v7.widget does not exist; Error: Symbol---not found in Javadoc add ignore error configuration

  //生成文档  task javadoc(type: Javadoc) {      false  }
    • (4) Pit four: Could not create version ' 0.1 ': http/1.1 401 Unauthorized [message:this resource requires authentication],-> no configuration The correct API Key

    • (5) Pit Five: There is no valid POM file-and must follow the steps to do and not configure the correct API Key:

If there are any problems later, you can communicate with each other.

8.GitHub

Android uploads the library to Jcenter ultra-simple complete steps and encounters with various 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.