How to add copyright to Android-Studio?

40,835

Solution 1

On the file you want to insert the copyright notice you have to press Alt+Insert for Windows and GNU/Linux or Command+N for Mac and select the copyright to be inserted.

http://www.jetbrains.com/idea/webhelp/generating-and-updating-copyright-notice.html

Solution 2

File > Settings > Editor > Copyright > Copyright Profiles > + add -> profile name

Sample Copyright Template Text

/**
 * Created by $username on $today
 * Copyright (c) $today.year . All rights reserved.
 * Last modified $file.lastModified
 */

If you need any extra variables, please visit source Copyright Profiles

Solution 3

You need to first create a copyright profile (Settings | Copyright | Copyright profiles), then go to Settings | Copyright and change the default copyright.

Solution 4

Go to Settings> Copyright> Copyright Profiles. Create one copyright profile. Then go to Settings | Copyright and change the default copyright to the one which you created and Apply>Ok.

And from the top menu Click Code -> click Update copy right and select the files you want to apply.

Solution 5

After you have configured the copyright settings and copyright profiles (Settings > Editor > Copyright) for your project, you can:

  • (Windows) Use Alt + Insert in an opened file to present the option for adding/updating the copyright
  • (Mac) Use Command + N in an opened file to present the option for adding/updating the copyright
  • Right click a directory or file in Android Studio's project view, and select "Update Copyright..."
Share:
40,835
klefevre
Author by

klefevre

Yet another mobile developer

Updated on July 09, 2022

Comments

  • klefevre
    klefevre almost 2 years

    The title says everything. If I want to add copyright comment in code files in Android Studio? I, of course, find the Copyright settings in Preference/Copyright, but I can't make it work... copyrights just don't appear when I create a new Java file.
    Is it a bug of Android Studio or did I miss something ?

  • alijandro
    alijandro over 9 years
    Can I share my copyright between projects? Every time I create a new project, i have to add a new copyright profile to the new project which is annoying.
  • jwehrle
    jwehrle about 6 years
    Couldn't figure out why my changes weren't showing up. Thanks.
  • Luke Simpson
    Luke Simpson almost 5 years
    Yes, thanks for explaining how to update default after adding the Copyright Profile.
  • krishnamurthy
    krishnamurthy over 4 years
    Is there any command to get the file's actual created date instead of $today?
  • Karthik Kompelli
    Karthik Kompelli over 4 years
    @krishnamurthy please follow this variables only available jetbrains.com/help/idea/copyright-profiles.html
  • Astha Garg
    Astha Garg about 2 years
    For new versions, Go to Android Studio> Preferences