S
S
Stanisav2015-05-28 11:54:11
Android
Stanisav, 2015-05-28 11:54:11

How to slightly change the project template in AndroidStudio?

Good afternoon. I am gaining experience in startandroid lessons and simplifying my life a little with the help of butter knife. Tell me how to change the build.gradle of a standard project and add a dependency there so that butter knife is automatically connected when creating a new project?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Emin, 2015-05-28
@NCNecros

Your question prompted me to figure it out :)
I found two options to choose from. Open the file with a text editor, add the dependency and save separately. Then you replace.
1. Add dependency to

<recipe>

    <dependency mavenUrl="com.jakewharton:butterknife:6.1.0"/>

    <#if appCompat><dependency mavenUrl="com.android.support:appcompat-v7:${targetApi}.+"/></#if>
...
</recipe>

2. Either add the dependency here
dependencies {
    <#if dependencyList?? >
    <#list dependencyList as dependency>
    compile '${dependency}'
    </#list>
    </#if>
    compile fileTree(dir: 'libs', include: ['*.jar'])
<#if WearprojectName?has_content && NumberOfEnabledFormFactors?has_content && NumberOfEnabledFormFactors gt 1 && Wearincluded>
    wearApp project(':${WearprojectName}')
    compile 'com.google.android.gms:play-services:+'
</#if>
    compile 'com.jakewharton:butterknife:6.1.0'
}

UPD: ATTENTION, when updating to 1.2.2, such a message flew out, most likely due to these changes. The message just refers to the file that I changed on the first point. I had to return the original file.
945944cb19564316879d41ead4def6eb.JPG

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question