How To Submit Your Android Library to J Center

This Is the article about how to publish Android library to JCenter and as well as in Maven Central

Please Follow the steps to get Publish

1.Setup your repository on Bintray

Sign Up for an Open Source Account

I Recommend Sign Up GitHub

And Now Create News Repository After sign up

Create Repository

Select Public or Private while private we need pay so we select public

Give Repository name and Select Maven as the Type and Select type of License and Type Some Description show below

Creating Repository

After Creating the Repository create Click On Add News Package Or Import You Project From GitHub

If Want to Do Manually Click the “Add New Package” button, fill in the data. You could use your GitHub repository for the “website” and “issue tracker” fields.

Now you should be able to access your new package using the Bintray URL. Here is mine: https://bintray.com/pratheepchowdhary/maven/InstagramPostViewAndroid

2.Set up Android Library Project

Check your Android project. I highly recommend you to make sure that your project has two modules: the Android Application (sample) and the Android Library.

Open your local.properties file (I hope it is in your .gitignore already, make sure that it is). Add your Bintray username and API key. You can get your key at https://bintray.com/profile/edit.

bintray.user=USERNAME
bintray.apikey=API_KEY

Open the build.gradle of your Project level module. You’ll have to add two plugins to help you package and publish the library.

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
view raw buid.gradle hosted with ❤ by GitHub

Open the Library build.gradle file . Set your data to every variable. Your library will be available as “publishedGroupId:artifact:libraryVersion”. It’s “in,androidhunt.instapostview:InstragramPostViewAndroid:1.04” for me and apply plugins which we described in project module and Check below example build.gradle of library for detail .

apply plugin: 'com.android.library'
ext {
// repo name which you created
bintrayRepo = 'maven'
//project name
bintrayName = 'InstagramPostViewAndroid'
//enter your package name
publishedGroupId = 'in.androidhunt.instapost'
//project name
libraryName = 'InstagramPostViewAndroid'
//project name
artifact = 'InstagramPostViewAndroid'
// some description about your library
libraryDescription = 'InstagramPostViewAndroid is an android libary to displays Instragram Embed Post Content To Your Android Appliaction Essaily With less Stuff'
// github
siteUrl = 'https://github.com/pratheepchowdhary/InstagramPostViewAndroid'
gitUrl = 'https://github.com/pratheepchowdhary/InstagramPostViewAndroid.git'
libraryVersion = '1.0.4'
developerId = 'partheepchowdhary'
developerName = 'Pratheep Kanati'
developerEmail = '[email protected]'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 4
versionName "1.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
view raw buid.gradle hosted with ❤ by GitHub

After Implementing Above Code in Your Library Project build.gradle and modify as per requirement for your project that’s all

3.Uploading Library to Bintray

After Integrating the plugins

Now we can Run Gradle Commands to upload to bintary


Clean Install is optional

First one is “install” to build your library and package everything that has to be published.

Second is “bintrayUpload” to, well, upload the files to Bintray.

After successful execution of these commands, you should be able to see your package updated on https://bintray.com. New “version” should appear.

After Upload In Bintray

That All Your Library Successfully published to Maven You Can see gradle Dependency as show below


Gradle dependency

To Use Above Gradle In android Projects .You Have Specify Maven Repository . To Find As Shown Below On Click On the Set Me Up Button In Your Package Shows Following Screen You Can Find Your Maven Link

Maven link .

After Publishing The Library to Bintray If want to Publish This library to J center Click on “Add to JCenter” button as Shown below

https://i2.wp.com/cdn-images-1.medium.com/max/800/1*jNNIoJi4XlQhKygtUNFsxA.png?w=1290&ssl=1
Add to jcenter

After Clicking The Add to J center It takes 2 to 24 hours to add to j center

On Successful You Can get Notification . After that, everyone will be able to include your library to their Android projects with just one line.

Demo Github Project https://github.com/pratheepchowdhary/InstagramPostViewAndroid

Referenced Article link:Original Link


Default image
pratheep kanati
I am a passionate programmer who is not afraid of a challenge. I push myself to achieve my goals and I love to strive towards perfection. The only thing I want to focus on is how I can make the best out of the situation, and how I can make it shine.
Articles: 30

8 Comments

  1. It’s the best time to make some plans for the future and it is time to be happy.
    I have read this put up and if I may I desire to recommend you some fascinating things or advice.
    Maybe you could write subsequent articles relating to this article.
    I want to read even more things approximately it!

Leave a Reply