在集成IM(融云的时候)出现了这个错误:
More than one file was found with OS independent path 'META-INF/DEPENDENCIES'
大概意思就是工程生成了不止一个META-INF/DEPENDENCIES文件,看起来是因为多个 jar 包里包含了同样的文件(DEPENDENCIES.txt),导致打包时因为担心相互覆盖问题而提示出错,在module的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'
}
android {
compileSdkVersion 26
defaultConfig {
...
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}