If you do not have a code cloud account, you need to register the code cloud first. The registration process is not the focus of this article and will not be covered here. This article focuses on how to upload code to the code cloud and associate the JITpack. Let’s use a utility class, MyUtils, as an example to illustrate the entire release process

1. Upload code to the code cloud

1.1 Creating a Lib project

Create a project named MyUtils

Next create a Module of type AndroidLibrary

The first version writes StringUtil and ToastUtil utility classes and adds them later

1.2 Log in to the Gitee account from AndroidStudio

Find Gitee in the Studio version control list. There are two ways to log in to Gitee. One is to log in with a user name and password, and enter the email address and password when registering gitee

1.2 Upload code to Gitee

Once you’ve logged into your gitee account in studio, you can upload your code to gitee. Find import into version control from the CVS menu

Then select the Share Project on Gitee option, Share.

1.3 Creating release Versions

The main purpose of the Gitee plug-in is to create a repository locally and a remote repository with the same name on Gitee. In this way, our local code is associated with the remote repository and we can log into our Gitee to check whether the remote repository has been created successfully. For our project to successfully publish to jitpack, in addition to successfully uploading the code to Gitee, we also need to create a release of the uploaded completed project

Click Create Distribution to take you to the create distribution page

2. Associate gitee with Jitpack

2.1 Associating gitee with JitPack

After the distribution is created, you can associate the JITPack. Log in to the JITPack using your Github account, enter the gitee token information, and associate the GITee

2.2 External Release

Enter the URL of the project’s home page on the jitPack home page, then click Lookup, and the JitPack will automatically generate the libraries that we will eventually reference, checking that our previous configuration meets the build criteria in the process

The green icon indicates that the generation succeeds, and the red icon indicates that the generation fails

The build file configuration in the root directory of the project is referenced first:

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io'}}}Copy the code

Next is the configuration of the project build file that needs to reference the library:

dependencies {
	        implementation 'com. Gitee. Yjkunkun: MyUtils: v1.0.0'
	}
Copy the code

After the construction is successful, we can write a test class to test whether the reference is successful. If the utility class inside can be used normally, our configuration is no problem.