22

I have trouble importing my custom file templates into Android Studio 4.1 Canary 5. In prior versions of Android Studio (up to 4.0) I used to copy my templates into

<Android Studio Installation>/Contents/plugins/android/lib/templates (I am using Mac)

But in 4.1, there are no templates there and when I copy mine there, they seem to be ignored.

Has anyone faced the same issue?

Thank you!

Rafa
  • 383
  • 3
  • 7

4 Answers4

16

Android Studio 4.1 uses a new templating API which is visible but not public yet - you can see a sample here, although I haven't been able to get this to work. Unfortunately in the process, Google seem to have removed the old way of adding templates.

For those interested in tracking progress, you can star the issue on Google's issue tracker system here.

ditn
  • 1,386
  • 1
  • 10
  • 23
3

For android studio 4.1 I found the live templates XML in this below path:

IDE configuration directory changes The locations of user configuration directories have been changed to the following:

Windows Syntax: %APPDATA%\Google<product>

Example: C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudio4.1

macOS Syntax: ~/Library/Application Support/Google/

Example: ~/Library/Application Support/Google/AndroidStudio4.1

Linux Syntax: ~/.config/Google/

Example: ~/.config/Google/AndroidStudio4.1

C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudio4.1\templates

Adarsh Sahu
  • 445
  • 5
  • 13
  • inside the relevant example folder, there should be a directory called `fileTemplates` (create it if its missing), place your templates inside. – CybeX Dec 18 '22 at 06:23
0

For android studio 4.1 I found the live templates XML in this below path:

~/Library/Application Support/Google/AndroidStudio4.1/settingsRepository/repository/templates

This is for Mac OS

0xAliHn
  • 18,390
  • 23
  • 91
  • 111
-5

File > Settings> File and Code templates> press + icon to add new template