Gradle publishes Android aar package to JCenter

1. JCenter official website: https://bintray.com

 

2. Register an account and follow the process yourself

 

3. Get your own username and apikey


 

4. Create a maven warehouse : select maven for the type, and the name must also be maven, otherwise you need to specify the name when uploading


 

5. Modify the AndroidStudio configuration file : add classes to the project's build.gradle

buildscript{
    dependencies {
        classpath 'com.novoda:bintray-release:0.8.0'
    }
}

 

6. Modify the AndroidStudio configuration file : add configuration to the module's build.gradle

apply plugin: 'com.novoda.bintray-release'
......
publish {
    userOrg = ''//bintray.com username
    groupId = ''//Path on jcenter
    artifactId = ''//Project name
    publishVersion = ''//version number
    desc = 'this is an andriod library'//描述
    website = ''//The address on github can be used
}

 

7. Under the project root directory, the console executes the upload script . If there is a jdk version problem, you can configure the jdk path in gradlew

gradlew clean build bintrayUpload -PbintrayUser=用户名 -PbintrayKey=apikey -PdryRun=f
alse

 

8. Wait for the upload to succeed

uploading:

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
<========-----> 64% EXECUTING [34s]
> :library:compileDebugJavaWithJavac
> IDLE

 Uploaded successfully:

BUILD SUCCESSFUL in 1m 55s
62 actionable tasks: 60 executed, 2 up-to-date

 

9. You can see the uploaded aar package in the newly created maven warehouse on the JCenter official website


 

10. After clicking the uploaded name to enter the detailed page, click the "Add to JCenter" button in the lower right corner to submit to JCenter.

After waiting for the approval, you can check it on the public network

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326101550&siteId=291194637