我使用过Android Studio与谷歌驱动器,这使得隐藏的系统文件可见(如Icon和desktop.ini),导致错误,如所描述这里.我不想运行脚本来删除这些文件,而是指示gradle 2.14忽略它们.
为了弄清楚如何排除文件,我在目录\app\src\main\res\values和中创建了名为"excludeme.txt"的文件\app\src\main\java\com\hfad\stopwatch\.我没有成功尝试对build.gradle项目中的两个文件进行各种修改.没有成功排除该文件.
具体来说,我根据这个问题对build.gradle文件进行了以下修改:Module: app
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'], excludes: ['**/excludeme.txt'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)
根据这个问题,我还将此添加到android同一build.gradle文件的部分:
aaptOptions {
ignoreAssetsPattern "!excludeme.txt"
}
Run Code Online (Sandbox Code Playgroud)
我还补充说:
sourceSets {
main {
java {
srcDir "src" [I also tried w/o this line]
exclude "**/excludeme.txt"
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我选择了Build > Clean …