Include Open Source Licenses in Your Project

Licenses are boring

Android third-party libraries are invaluable and every Android app uses them. Unfortunately, every library has a license. You have to include copies of those licenses in your product. It’s required. So what’s the best place?

Best place for licenses

It belongs to hell but put it to Settings. A typical user is almost never interested in reading licenses, so we don’t want to expose these too much. The most popular practice is to put these into About page. And that’s my suggestion. 

Example

Let’s see how Google itself handles it in the Google Chrome app. In Settings, there is “About Chrome” item. It includes application version, operating system and finally Legal information. Inside we can find Open source licenses in a long Recycler View list. 

Don’t mind “American fuzzy lop”. He is certainly not in a good mood today. We better get out of here.

How it's done

The average Android project uses tens of dependencies so listing them one by one usually doesn’t make sense. Fortunately, Google came up with an easy solution. All you have to do is to copy and paste a few lines to your gradle files and you are pretty much done. You don’t even have to create a new activity yourself. It’s already done so you can start OssLicensesMenuActivity from almost anywhere. The only requirement is access to a Context of course!

Alternatives

The activity that is generated for you could look better but I truly believe that it’s good enough and we should spend the time we just saved on more densely populated activities. Anyway, there are alternatives. Popular libraries that provide different results are:

1. license-tools-plugin Flexible but more complicated

2. gradle license plugin That exposes your license and links to notices for packages. This library creates dialog fragments instead of activities

3. Android License Fragment  Name explains everything. Although it wasn’t updated for 2 years

4. Easy licenses dialog Although this is deprecated now

Jakub Chmiel

I’m Jakub Chmiel. In the Android world, I’m in the process of developing 2 project management mobile applications for construction teams. In these projects, I add business value fast trying to minimize technical debt.

Leave a Reply

Your email address will not be published. Required fields are marked *