当我尝试构建项目时出现以下错误。当我尝试在项目中添加JavaMail api时会发生此错误。
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> More than one file was found with OS independent path 'META-INF/mailcap.default'
这是我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.persi.eatery"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:26.1.0'
compile 'com.google.firebase:firebase-database:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.sun.mail:android-mail:1.6.1'
compile 'com.sun.mail:android-activation:1.6.1'
compile project(':library')
}
apply plugin: 'com.google.gms.google-services'
我的图书馆gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
我试图实现以下在类似问题上找到的解决方案: On gradle:3.0.0 More than one file was found with OS independent path 'META-INF/ASL2.0'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
但它没有解决问题。 Ps我对gradle文件不太了解