Android Studio构建错误:使用操作系统独立路径'META-INF / gfprobe-provider.xml'找到了多个文件

问题描述 投票:0回答:1

我正在构建一个简单的Android应用,用户可以在其中发送/接收电子邮件。我正在使用Java Mail API。我的代码在eclipse中运行良好,但是现在我正在使用Android Studio,但出现了构建错误。

一个答案建议我将此添加到我的build.gradle文件中。但这没有帮助

android {      
      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'
      }          
}

这是我的build.gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.javaemailapp"
        minSdkVersion 24
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation files('/Users/redacted/Downloads/javamail-1.4.4/mail.jar')
    implementation files('/Users/redacted/Downloads/jaf-1.1.1/activation.jar')
}

我只想测试一下“发送”按钮是否在我的应用程序中有效,但是当我单击在Android Studio中运行时,出现此错误:

[使用操作系统独立路径'META-INF / gfprobe-provider.xml找到了多个文件]

java android-studio javamail
1个回答
0
投票

使用JavaMail for Android的较新版本。

© www.soinside.com 2019 - 2024. All rights reserved.