解决 AndroidStudio项目编译More than one file was found with OS independent path 错误
异常信息:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> More than one file was found with OS independent path 'META-INF/DEPENDENCIES'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
错误原因:在系统依赖路径中找到超过1个的META-INF/DEPENDENCIES 文件,重复加载
More than one file was found with OS independent path 'META-INF/DEPENDENCIES'
解决方法:修改 app/build.gradle 文件,添加
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}