1. 程式人生 > >Android Studio使用jakewharton:butterknife

Android Studio使用jakewharton:butterknife

Android Studio使用jakewharton:butterknife 每次建立一個專案都得新增一次,感覺好麻煩,然後去androidstudio安裝的目錄找了配置檔案,增加了配置檔案,這樣每次建立專案就不用每次新增compile,這是我的androidstudio安裝路徑  C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle-projects\NewAndroidModule\root

,在root資料夾中修改build.gradle.ftl .在dependencies {
<#if isLibraryProject || !(isInstantApp!false)>
    compile fileTree(dir: 'libs', include: ['*.jar'])
   compile 'com.jakewharton:butterknife:7.0.1'


    androidTestCompile('com.android.support.test.espresso:espresso-core:${espressoVersion!"2.0"}', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    <#if WearprojectName?has_content && NumberOfEnabledFormFactors?has_content && NumberOfEnabledFormFactors gt 1 && Wearincluded>
    wearApp project(':${WearprojectName}')
    compile 'com.google.android.gms:play-services-wearable:+'
    </#if>
<#elseif alsoCreateIapk!false>
    compile project(':${atomName}')


</#if>
}