5

In Eclipse there is simply option to import or export code template. I want to do same in android studio but there is not any direction option to do so.

I have create one template and now i want to apply it to all my other system so i need to export & import.

I have one option to do but i just want to know that is any other way to do.

  1. Create your code template file in eclipse and export.
  2. Exported file will be XML.
  3. Now copy that XML file and move to ..//.AndroidStudio/config/templates
  4. Restart Studio and Use it.

Can you please help me out.

Thanks for your time.

Chintan Khetiya
  • 15,962
  • 9
  • 47
  • 85

1 Answers1

6

System-independent solution:

Go to File -> Export Settings, choose only Live templates, and export it to a file. Then you can use File -> Import Settings and provide this file to import live templates.

(I haven't tested it myself so I'm not sure how exactly the Import Settings works. I don't know if it merges the settings with your current ones or swaps it entirely. Bare that in mind when trying...)


System-specific solutions:

Mac OS:

Go to /Users/<username>/Library/AndroidStudioX.X/templates/.

There's where user.xml file containing your Live Templates should be.

Linux:

The templates are saved inside ~/.AndroidStudioX.X/config/templates/Android.xml

Community
  • 1
  • 1
Bartek Lipinski
  • 30,698
  • 10
  • 94
  • 132
  • I'm on Linux and my templates are in a `Folder` (where there are further subfolders to categorize templates). Also I don't have an `Android.xml` file in `templates` folder. How do I add the template-folder please? – Sorry Sep 15 '20 at 10:41
  • @LeNguyenDuyAnh is there any (hidden) directory in `~/` with `AndroidStudio` text in its name? – Bartek Lipinski Sep 15 '20 at 11:34
  • There is `.AndroidStudio4.0` inside and then I can navigate to `config/templates` but no `Android.xml` there. – Sorry Sep 15 '20 at 22:20
  • @LeNguyenDuyAnh did you try the `System-independent solution`? – Bartek Lipinski Sep 16 '20 at 08:23