Shared publicly  - 

ADT Template Format Documentation

If you've used ADT [1] to create a new Android project recently, you may have noticed that you have a few more options available for what type of UI you'd like to start with. For example, you can create an app with a simple activity containing an action bar and horizontally-swipeable tabs, or an app containing a set of activities and fragments representing a master/detail flow.

The magic lies in the new ADT templates that +Tor Norbye and I have been working on for the past few months in AOSP. Now, the current set of available templates in ADT 20 is just the beginning, and in the ADT 21 previews [2] you've seen a preview of the next set of templates in progress.

But what if you wanted to build your own templates, or integrate templates into your shell scripts or alternative IDE? Well, we now have formal documentation about the template format and syntax, published alongside the 'official' templates right in AOSP:

Since Google's git hosting doesn't offer viewing the raw HTML, I've also taken the liberty to temporarily mirror the latest version of the doc here using Dropbox:

If you'd like to build your own templates for ADT (i.e. for use within your own team), simply create a template directory following this format (take a look at the official ones [3] for examples) and drop it in <sdk>/extras/templates/. It'll then show up in Eclipse under New > Android Object alongside the official ones, after a restart.

It's also worth noting that the templates are decoupled from ADT and don't have any strict dependencies on Eclipse. So if you're the developer of an alternative Android IDE, feel free to implement this format… and of course let us know if you have any questions or suggestions regarding the syntax or template structure.

Thanks, and happy templating!

Jeff McAffee's profile photoDaniele Segato's profile photoLars Vogel's profile photo毛瑞斌's profile photo
This is beyond awesome! I can only guess what kind of awesome open source projects there will be one year from now providing variety of responsive templates for different design approaches and different sets of devices and even beyond that

I think that this is the biggest step taken in Android tooling so far. Amazing job guys!
Also if you're the developer of alternative Android tools, we probably have some code in somewhere that can help you process those templates. +Tor Norbye can point you to where this code lives.

And if it's not in a library that's separate from ADT yet, we'll make sure to move it to one ASAP.
The templates are a handy inclusion, but it'd be nice if they also made use of things like ActionBarSherlock so that I can get an app up and running quickly on a broader range of Android versions.
What great news, Roman, it will help me a lot! And I agree with Andrew, some integration with ActionBarSherlock would be great! Anyway, thanks for your work! :D
i love the template options.  Real time saver.
Great news indeed! This will save us lots of time and improve the quality and efficiency of our work! Many congrats!
Are there any plans to create a template library like the Chrome Web Store?
This is good. However for minor conditional code substitution, the Antenna preprocessor has served me well. Yes even for Android (+eclipse)
Got this message: "This template requires a more recent version of the Android Eclipse plugin. Please update from version 20.0.3." But mine is 20.0.3. What's wrong ?
+Hervé LOPEZ this is for the upcoming ADT (21). You can try the preview version or wait for the release. You cannot use this with the current version.
bq y
I want to say "NB!"
Great news! I played around a bit and was wondering why there is the  value "Applications" for the category element (template.xml)... Is it possible to add application templates, too? And besides that, will it be possible to use the dependency element (template.xml) for custom libraries in a future release? Thanks in advance!
+Johannes Köstler "Applications" is for top-level projects; unfortunately currently this is tied to a custom UI in Eclipse so you can't create custom project templates AFAIK. As for custom dependencies, that's the goal, but right now we have a static set of dependencies baked into ADT. /cc +Tor Norbye 
bq y
How can I get ADT 21 ?
+Roman Nurik I would like to ask you again something almost one year after, is it still NOT possible to add application templates? I've trying but without luck. Thanks in advance!
+Cecilia Amadio you should be able to add templates by dropping them into the same folder as the others under the SDK root directory.
WOW, thanks for the quick answer!! I’ve trying to create a new “Application” template, just coping it in the folder \sdk\tools\templates\projects but I don’t find a way to access it. I mean there is no place in the ADT where I can choose from different “Applications” templates.
How do I trouble shoot problems with custom templates?

ADT fails to generate any files when I use a variable from the globals.xml.ftl file (I do have the globals element populated in the template file). Works when I use a parameter from the template file. What am I missing?
I just found this!

The dropbox mirror is gone tough. But thanks! I'll just clone the repo myself and look it locally!

This should really be more pushed so that developer start to write their own templates and share them with others...
I'm thinking about some kind of repository handling for templates. As user you can add a repository for templates and it magically add those templates to Android Studio: that would be totally handsome!
hello, I have a try to make a customized template in android studio ,now I hava a problem
, I use template to create a Activity ,At the same time ,I need merge some code to another 
.java file ,but I am failed , this place, I watched the theory of dynamic merge AndroidManifest.xml file ,and in my slide , I merged code to a .java file but faild ,so how should I do ? thanks 
Add a comment...