Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Android Studio use my build.gradle template for a new project?

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?

like image 987
jaumard Avatar asked Mar 17 '23 15:03

jaumard


2 Answers

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

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

like image 100
Andy Aspell-Clark Avatar answered Apr 07 '23 00:04

Andy Aspell-Clark


→ ~/../../sdk/tools/android create project 
--activity MainActivity 
--package com.example.android 
--target 3 
--path ~/AndroidStudioProjects/Example
--gradle YOUR_GRADLE_TEMLATE_PATH

to see details:

→ ~/../../sdk/tools/android -h
like image 20
DaVinci42 Avatar answered Apr 07 '23 02:04

DaVinci42