We often use open source projects on GitHub, and the steps are simple
Like what:
' acffo.xqx.xwaveviewlib:maven:1.0.0 '
Learn how to make your own library of open source projects that can be used by others.
One, Android studio project preparation
At this point we want to write a custom control that we want to upload to GitHub for others to use.
1, first create a module under the project
2. Select Android Library
3. Fill in the class library name
4. Directory structure at this time
Note that open source is out of library class libraries, so you need to write custom controls or other code in the class library, not in the app directory
5. Create a custom control view
6. In the app directory, write the sample code that uses the class library, and let the app rely on the library
Ii. Preparation of Bintray
1, first create a Bintray account, registered address Https://bintray.com/signup/oss Note this is a personal account registration, many articles to the link is the company account registration.
There is a note: The mailbox can not be 163 and maybe there is nothing else to use, it is recommended to use Google Gmail mailbox.
2. After creating a successful search, select Create an organization.
You can see the organization that has been created
3, choose to enter a, such as I enter the xqxlibrary organization, then the interface as follows, and then continue to click Create Warehouse
4. Create a warehouse interface as follows
Once created, you can see that there is a warehouse in the Xqxlibrary organization.
5, finally we want to record their own Bintray user name and API Key value, Android Studio configuration will need to
Copy API Key
Third, Android Studio project configuration
1. build.gradle configuration under the root directory
Add in dependencies{}
' com.novoda:bintray-release:0.3.4 '
Add in Allprojects:
Tasks.withtype (Javadoc) { options.addstringoption ('xdoclint:none') -quiet') options.addstringoption ('encoding ' ' UTF-8 ' ) }
The end result is as follows:
Buildscript {
repositories {
Jcenter ()
}
dependencies {
Classpath ' com.android.tools.build:gradle:2.2.2 '
Classpath ' com.novoda:bintray-release:0.3.4 '
}
}
allprojects {
repositories {
Jcenter ()
}
Tasks.withtype (Javadoc) {
Options.addstringoption (' Xdoclint:none ', '-quiet ')
Options.addstringoption (' Encoding ', ' UTF-8 ')
}
}
2. Build.gradle configuration under Module directory
(1), top-Most add code
' maven ' 'com.novoda.bintray-release'
(2), Bintray configuration data area
//AddPublish {userorg='xqxlibrary' //Organization NameGroupId ='Acffo.xqx.mycustomview' //the package name of the class libraryArtifactid ='maven'//project name, custom Publishversion='1.0.0' //Version numberdesc ='Wave Flow effect' //DescriptionWebsite ='Https://github.com/BestCoderXQX/XWaveView' //GitHub address You can push your project to your GitHub, the address of the project}
All code:
Apply plugin: ' Com.android.library 'Apply plugin:' Maven 'Apply plugin:' Com.novoda.bintray-release 'Android {compilesdkversion25buildtoolsversion"25.0.3"Defaultconfig {minsdkversion15targetsdkversion25Versioncode1Versionname"1.0"Testinstrumentationrunner"Android.support.test.runner.AndroidJUnitRunner"} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro '}}}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 '}//AddPublish {userorg= ' Xqxlibrary 'groupId= ' Acffo.xqx.xwaveviewlib 'Artifactid= ' maven 'publishversion= ' 1.0.0 'desc= ' wave flow effect 'website= ' Https://github.com/BestCoderXQX/XWaveView '}
View Code
Iv. executing the GRADLEW command statement
Gradlew Clean Build bintrayupload-pbintrayuser=-pbintraykey=6f5e4e11d2d253a2d4**************-PdryRun= false
The explanations are as follows:
-pbintrayuser=a463674420 (here is the website avatar next to the corresponding account, there may be the URL above the same, must distinguish good)-pbintraykey=6f5e4e11d2d253a2d4********** (This is the API key which lets everyone copy and save)-pdryrun=false(if it is false then it will be true, if true does not go to the actual commit, but will compile, can go to see if the compilation passed at commit)
Execution to successful means success.
V. Submission of audits
Find a warehouse under the built organization, you will find one more package
Click to enter, click on the right side of the "Add to Jcenter" can be submitted for review, use the time to click on the lower left side of the ' Gradle ' can
Android Project Combat (38): 2017 latest Androidlibrary submitted to Jcenter Warehouse (graphic tutorial)