Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 发现多个文件具有独立于操作系统的路径';META-INF/mailcap.default';_Android - Fatal编程技术网

Android 发现多个文件具有独立于操作系统的路径';META-INF/mailcap.default';

Android 发现多个文件具有独立于操作系统的路径';META-INF/mailcap.default';,android,Android,我试图通过Gmail发送邮件,但它产生了一个错误。当我构建我的应用程序时,我没有收到任何错误,但当我运行我的应用程序时,它会给出以下错误 发现多个文件具有独立于操作系统的路径“META-INF/mailcap.default” 我尝试了很多事情,但都解决不了,所以请帮忙。 谢谢 我的app build.gradle文件是 apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig {

我试图通过Gmail发送邮件,但它产生了一个错误。当我构建我的应用程序时,我没有收到任何错误,但当我运行我的应用程序时,它会给出以下错误

发现多个文件具有独立于操作系统的路径“META-INF/mailcap.default”

我尝试了很多事情,但都解决不了,所以请帮忙。 谢谢

我的app build.gradle文件是

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.example.user.mysqldatabaseapp"
    minSdkVersion 15
    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'
    }
}
packagingOptions {

    pickFirst 'META-INF/LICENSE.txt'
    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'
}
}


dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.volley:volley:1.1.0'
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.sun.mail:javax.mail:1.6.1'
implementation 'com.sun.mail:android-activation:1.6.1'
}

这是因为有多个依赖项在其包中包含
META-INF/mailcap.default
。因此,通过添加
pickFirst
行,您只需要使用
META-INF/mailcap.default
中的一个。大概是这样的:

packagingOptions {
    // use only one
    pickFirst 'META-INF/mailcap.default'

    pickFirst 'META-INF/LICENSE.txt'
    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'
}