Open source your Android Library

Android library
Rate The App - Part Two: Making your Android Library Open Source

Series overview

This is the second in a series of blog posts about the process and experience of creating and publishing our “RateTheApp” widget in an Android Library.

Read the first part of the series here. The series as a whole will look something like this:

In this post we'll look at how to make your Android Library open source to serve the developer community.

Write a project README file

If you followed the instructions mapped out in our first post Creating an Android Library then you'll have already started your README file.

It's now time to finish this (or start for the first time if you skipped that step).

It's crucial to create a project README file so that developers know what RateTheApp is, what it looks like and also to provide examples of how they can customise it.

Here's how:

You can directly create and edit your README on the GitHub website. Github will allow you to preview it before saving but bear in mind that each save is a separate Git commit.

The GitHub Readme.md uses the MarkDown syntax. If you're not familiar with this then take a look at this: https://guides.github.com/features/mastering-markdown/

You'll need to prepare image assets (in our case taken from our Demo App) to show what RateTheApp looks like and how it can be changed. Obviously you don't have to, but this will be the best way to illustrate and communicate to your readers.

If it helps, you can find our README on our project page https://github.com/brightec/RateTheApp-Android

Tips on writing README files

In case you've never written a README file before, here are a few starter tips:

Firstly, show what your widget looks like.

Next, show how to use it. It would easy to just show what it looks like, but you'll impart the most knowledge by actually showing how it can be used.

Finally, show how to customise it.

Thankfully, someone has produced a README containing a curated list of awesome README files! https://github.com/matiassingers/awesome-readme

Decide on an open source license

This is an important step in creating your Open Source project - it is the license that actually makes it Open Source!

To help, Github have produced a guide to choosing an Open Source License https://github.com/blog/1530-choosing-an-open-source-license

For our project, Apache License 2.0 was chosen and a LICENSE file created in the top-level of the project.

Simply add Apache block to top of each file in the project using the following instructions from the License file.

How to apply the Apache License to your work

The following is copied verbatim from the License file:

To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!)

The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.



Copyright {yyyy} {name of copyright owner}



Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0



Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Go public

The final step: Press the button on Github and your README file is now public.

(Now your repo is public, go back and fix the backlinks from the demo app).

Congratulations, you have now open-sourced your Android Library!

In part three we'll look at how to publish your Android Library.


Looking for something else?

Search over 400 blog posts from our team

Want to hear more?

Subscribe to our monthly digest of blogs to stay in the loop and come with us on our journey to make things better!