Brief android studio how to upload your own library to jcenter

The first step:
create a new project, create your own library module.

In the library, only to return a string of tools, just to test. Add this app relies on the normal operation.

Step:
Add build.gradle dependencies in a project
classpath 'com.novoda: bintray-release: 0.9.1'

 dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.novoda:bintray-release:0.9.1'
    }

Github dependent on the official website of the latest version, you can modify the latest version:
GitHub official website: https://github.com/novoda/bintray-release

Finished adding sync bit, as shown below: Here Insert Picture Description
The third step:
to register bintray, registered URL https://bintray.com/signup/oss
Here Insert Picture Description
with github or Google account registration will do, but can not verify when or 163 qq mailbox. I use gmail mailbox. Log by the following:
Here Insert Picture Description
Click Add New Repository to create a new repository, I have established good.
Here Insert Picture Description
Fill out the information as shown on the line. Then create a new warehouse in a package Here Insert Picture Description
Here Insert Picture Descriptionto this file submission warehouse has been created
to take note that this and fill in the Name, and the name of the configuration to be behind android studio unanimous. Otherwise upload will fail.

Step Four:
Configure androidstudio upload information:
Open to upload module in build.gradle.
Added at the top:

apply plugin: 'com.novoda.bintray-release'

At the end add:

publish {
    userOrg = 'yinzhipengwork'                               //bintray.com 账号用户名
    groupId = 'com.yzpUtils'                                 //唯一 id,最后依赖的库名组成部分之一
    artifactId = 'StringUtillib'                             //仓库名
    publishVersion = '1.0.0'                                 //版本号
    desc = 'hello jcenter'                                   //描述
    website = 'https://github.com/YZP0721'                   //开源项目网址
}

As shown below:
Here Insert Picture Description
Here Insert Picture Description
userOrg bintray use your registered name, artifactId create a package you use to fill in the name before. You can refer to the following diagram:
Here Insert Picture Description
Step Five:
Upload library:
in android studio console
Here Insert Picture Description
run the following command:
gradlew Clean Build bintrayUpload -PbintrayUser = XXXX XXXXX = -PbintrayKey to false -PdryRun =

There are two values, and by acquiring: Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
PbintrayUser your registered name, that userOrg value.
PbintrayKey is the value of your APIkey.
run! ! Upload successful! The following figure:
Here Insert Picture Description
Here Insert Picture Description
you can see the information has been uploaded.

Here is how:
go bintray can see the items you just uploaded.
Here Insert Picture Description
Then you can create a test project:
because we upload the project has not been submitted to jcenter review, we do also need to add maven:
Add (that is, the icon out of the address) in build.gradle project

maven { url 'https://dl.bintray.com/yinzhipengwork/maven' }

Add rely on build.gradle app module's (also on the icon out of the address)

implementation 'com.yzpUtils:StringUtillib:1.0.0'

in
Here Insert Picture Description
Run the code:
Here Insert Picture Description
Here Insert Picture Description
string package before returning success to get the perfect Sahua.

There is one final step:
submit jcenter:
Here Insert Picture Description
Audit Success can be used directly after

implementation 'com.yzpUtils:StringUtillib:1.0.0'

This line of code can be referenced, you do not need a maven.

Released four original articles · won praise 6 · views 258

Guess you like

Origin blog.csdn.net/yzp1121/article/details/95974992