Android releases personal open source projects to JCenter in two ways: digging and filling (2)

Keywords: Android Gradle Maven github

Preface

The previous article introduced submitting open source projects to JCenter -, through gradle-bintray-plugin Android releases personal open source projects to JCenter in two ways: digging and filling (1)

This article introduces the second way to publish open source projects to JCenter through the bintray-release plug-in.
About the registration method, the last one has explained, this one will not explain.
Unlike the first method, you don't need to create a maven repository. Configuration takes only two steps

The first step is to configure the build.gradle of the project. Note here that it's Project, not Moudle.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.2.0'
        classpath 'com.google.gms:google-services:2.0.0-alpha3'

       //Add the following sentence
       classpath 'com.novoda:bintray-release:0.3.4'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" }
    }
}

The second step is to configure build.gradle for library to upload.

apply plugin: 'com.android.library'


android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


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

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    testCompile 'junit:junit:4.12'
}

//Start configuring from here

//Add the following sentence
apply plugin: 'com.novoda.bintray-release'

publish {
    userOrg = 'dazhao'    //User Name at Registration
    groupId = 'com.ddz.materialdesign'//   // Part 1 of Compoile Reference
    artifactId = 'FloatingActionButton'////Published to JCenter The project name above, compile Part 2 Project Name at Reference
    publishVersion = '1.0.1'//Version number, the last part of the compile reference, the next update is just to change the version number.
    desc = 'A customizable FloatingActionButton on Android'//Description, not important
    website = 'https://github.com/dazhaoDai/FloatingActionButton'  //Project GitHub website
}

The two-step configuration is complete and ready for submission
Still open the Terminal of Android studio and enter the following completion, just changing the values of user and key

gradlew clean build bintrayUpload
-PbintrayUser=dazhao //Registered username
-PbintrayKey=xxxxxxxxxxxxxxxxxxxxxx //Previously obtained apikey, method see Article 1
-PdryRun=false

Enter, wait for the operation to complete, still see BUILD SUCCESSFUL on the completion, follow-up steps and the first one, I have copied it, continue to look down.

9. Open the maven repository at this time and you can see that the submission has been successful.


Now you need the last step to get into the project. There is an Add to Jcenter button in the lower right corner.


10. Click Open, Add Description Information, Click Send, Wait for JCenter Audit

11. Audit wait time is not very long, or even about an hour to succeed, after the audit passed, the Add to Jcenter button will disappear, and will be prompted by the message.

So far, through the bintray-release mode, submit the open source project, and it is completed. We can happily use our own wheels.

compile 'com.ddz.materialdesign:FloatingActionButton:1.0.1'

Posted by inspire on Wed, 03 Jul 2019 12:15:04 -0700