Copyright Profiles & Android Studio

A Developer 😀
4 min readJul 17, 2020

What is Copyright?

According to Wikipedia, a Copyright is a type of intellectual property that gives its owner the exclusive right to make copies of creative work, usually for a limited time. This creative work can be in the field of art, education, software, etc.

More about Copyright: https://en.wikipedia.org/wiki/Copyright

Preface

Following processes in the right order is quite hard just before the release date of the product in the market, there is too much pressure on the people involved e.g. it is very hard to edit every single file in a project to add the Copyright message just before releasing anything new in the public domain especially when the organization has distributed Geographical teams. But following the book and adding such things are quite important from the business and legal perspective.

In such a situation, there is always a need to either automate the process or tweak the existing process in such a manner that responsibilities will be shared among the team members and it becomes a habit in a daily routine. Android Studio’s Copyright profiles feature comes into the picture which is capable of adding a copyright message on the existing project files and also while adding new files in the repository during the check-ins.

Copyright Profile Creation & Usage

The creation of a copyright profile and updating the whole android project with the Copyright template can easily be done in a few easy steps. After following these steps even adding a copyright message on every new file in the project will be like a stroll on the beach.

Step 1: Create a copyright profile in Android Studio

  • Open Preferences and navigate to Editor -> Copyright -> Copyright Profiles.
  • Create a new profile and give it a proper name e.g. SampleProfile.
  • Either update or replace the copyright text already present in the dialog box.
  • Make sure to replace the sample template with either your or the company name to whom the copyright belongs to.
  • The $today.year code is a template that will just apply a current year in the copyright message.
  • Click Ok.
Copyright profile creation

Step 2: Create a scope to apply the copyright profile

  • Open Preferences dialog once again and navigate to Editor -> Copyright section.
  • Apply the created profile as the default copyright profile for the project
  • Select Project Files as the scope and apply the create profile “SampleProfile” to it from the dropdown. One can apply different profiles to different scopes in this section.
  • Click Ok to make changes to take effect.
Scope selection for copyright profile

Step 3: Apply the profile to the whole project

  • It’s time to update all the files in the project with a copyright profile.
  • Open the context menu by right click on the project root and selecting Update Copyright from the menu.
  • Select the Whole project and Include test sources options under the Update Copyright scope. And if required select the Update existing copyrights option.
  • Click Ok and within the blink of an eye, all files will be updated with the copyright message.
An updated project file with a copyright message

Step 4: Copyright updates during check-ins

  • While committing changes using Android Studio just check the Update Copyright option so that the changed files will have the copyright profile applied to them.
Copyright updates during check-ins

Template File Location

  • The copyright profile template can easily be found in the Copyright folder present inside the .idea folder. The template file is an XML file with the same name as the copyright profile name.
Copyright Profile Template File

Conclusion

It’s always important and critical for an individual or an organization to protect the original creation and ideas. Just go ahead and use such a nice feature of Android Studio and become an integral part of the process.

Thanks :)

Happy Coding :)

--

--

A Developer 😀

Reader | Traveller | Freelancer | Android & Fullstack Developer | Open-Source Enthusiast | Loves Automation