如何让Android Studio将build.gradle模板用于新项目? [英] How to make Android Studio use my build.gradle template for a new project?

查看:729
本文介绍了如何让Android Studio将build.gradle模板用于新项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个build.gradle来增加发布版本的prod版本代码以及我想要的所有未来项目的其他配置,有没有办法告诉Android Studio(或者intelliJ)使用我的build.gradle for all我创建的新项目?
或者IDE是否可以使用模板我可以修改gradle文件?

I make a build.gradle to increment prod version code on release build and some other config that I want for all my futur projects, is there a way to tell Android Studio (or intelliJ) to use my build.gradle for all new project I create ? Or maybe is there a template use by IDE for gradle file I can modify?

推荐答案

我发现android studio不使用sdk目录中的模板。我找到了模板:

I have found that android studio does not use the templates from the sdk directory. I have found the template in :

<android-studio>/plugins/android/lib/templates/gradle-projects/NewAndroidProject/root/build.gradle.ftl

你可以尝试将你的gradle函数放在这里和android studio应该为每个新的Android应用程序项目选择它们

you could try putting your gradle functions in here and android studio should pick them up for every new Android application project

这篇关于如何让Android Studio将build.gradle模板用于新项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆