2

I have an existing project in android studio, there are near about thousand file and most of them have a header or copyright message like this .

package com.example.utils;

import android.content.Context;
import android.content.res.Resources;
import android.media.MediaPlayer;

import com.google.android.gms.common.api.GoogleApiClient;
import com.google.firebase.iid.FirebaseInstanceId;



/**
 * Created by Developer on 11/27/16.
 * For Company
 */

Now I am asked to change that into

/*

 * Copyright (c) 2004-2017 by Company, Inc.

 * All Rights Reserved

 * Company Confidential

 */

As there are a lot of file how can I change all them at once

mSapps
  • 601
  • 9
  • 24

2 Answers2

1

Default Copyright Notice

You can change Default Copyright Notice in Copyright Profiles

In windows: File > Settings > Editor > Copyright > Copyright Profiles

In macOS: Android Studio > Preferences > Editor > Copyright > Copyright Profiles

To update existing ones:

Updating a Copyright notice

In the Project tool window, select files or directories where you want the copyright notice to be updated or just open the desired file in the editor.

Right-click the selection, and choose Update Copyright on the context menu. 

To have copyright notices updated correctly, make sure that the keyword specified in the copyright profile is a part of the notice definition. Otherwise, IntelliJ IDEA will not detect copyright notices and, instead of updating existing notices, will insert new ones.

To keep Copyright Notice Up to date:

You can use a regular expression to keep old ones up to date, for more detail see original documentation. From jetbrains documentaion:

Allow replacing copyright if old copyright matches: Use this text box to type or edit the regular expression pattern that will be recognized in the existing copyright notice and allow replacing it with the new one. For example, if you specify the following pattern for year indication: 20[0-1][0-6], updates will affect all the copyrights with the indications of years 2000-2006 and 2010-2016.

Hamid Asghari
  • 5,751
  • 4
  • 24
  • 34
  • I have changed it, but it doesn't change the existing copyright notice in the existing file – mSapps Jul 23 '17 at 09:43
0

In the latest Android Studio, you still change it in Settings > Editor > Copyright > Copyright Profiles.

Here's the template in your case:

/*

 * Copyright (c) 2004-$today.year by Company, Inc.

 * All Rights Reserved

 * Company Confidential

 */
6rchid
  • 1,074
  • 14
  • 19