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>
}