The way to put up an Android library: a mysterious conversation

I recently met an alternatively mysterious chap referred to as Nick. Nick was a hobbyist Android developer, and he desired to understand how he ought to publish a number of his code as a library for other builders to use. Having completed the same aspect in advance this 12 months, I did my excellent to assist.

Nick: Ho ho ho, hello Max!

Max: Err, hello. Am I now not sure I realize you?

Nick: Oh. No, I don’t understand you either. But what’s up beside, I’m Nick, and it’s jolly right to fulfill you!

Max: High-quality to meet you too, Nick.

Nick: I’ll get right to the point; I was hoping you might be able to help me with a touch Android mission of mine? I’ve been dabbling in Android development, and now I’ve got a few codes that I think different builders might discover useful. I need to submit it as a library, But I’m not certain in which to start.

Max: Ok, well, one of the simplest approaches to applying to a website known as Bintray.

Nick: I think I’ve heard of that.

Max: Yeah, a variety of libraries are hosted there. The default source for dependencies in all-new Android Studio tasks is a Bintray repository called JCenter.

To put up your code as a library on Bintray, there are 3 steps:

Get all of the library code into its own library module in Android Studio.


Read More Article:

Install an account on Bintray at the side of a repository and a package deal for your library.
Upload some code yours to the construct—gradle record.

Nick: O.K., how long will all that take? Do your thoughts going through it collectively now?

Max: certain, it shouldn’t take too lengthy.
A library module

Nick: The code I want to proportion. At the moment, it’s just a part of an actual Android app I’ve been working on.

Max: That’s first-rate; we can create a new module within that existing mission and publish handiest that.

Nick: Adequate, so I go to “document” > “New” > “New Module…”, then is it this one, “Android Library”?

Max: Yep, that’s it. Now you want a name and make sure the package deal call of the brand new module is distinctive to that of the app, or it won’t construct.

Nick: Ok, properly, the app is known as the Electronic Listing Facility (ELF). However, I will call the library “Naughty or Exceptional,” after which the module call might be “naughty or nic,e” and the bundle called “north pole.Nick.Naughty or nice”.

Max: What does this code do, Nick?

Nick: Ho ho ho, nicely you notice it’s for checking whether or not a person is at the naughty Listing or the Quality List.