java - Android Studio 构建错误:发现多个文件具有操作系统独立路径“META-INF/gfprobe-provider.xml”
问题描述
我正在构建一个简单的 android 应用程序,用户可以在其中发送/接收电子邮件。我正在使用 java 邮件 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”
解决方案
使用更新版本的Android 版 JavaMail。
推荐阅读
- javascript - 如何使用 javascript 用动态内容覆盖子节点值
- java - 如何自下而上在网格中添加对象?
- javascript - 我们如何使用 mysqli 将包含来自 xml http 请求的文本的数组发送到 PHP?
- dask - 创建后是否可以将工作人员资源分配给分布式工作人员?
- reactjs - 为什么只有从循环生成的元素才能获得“关键”属性?
- javascript - 如何在 ES6 中有效地进行深度省略
- ruby - 如何使用 Tk 在 Ruby 中最轻松地确定键盘上不寻常键的键符?
- dspace - 如何使用 Fuseki 在 Dspace 中实现链接数据?
- javascript - 在 react 中从 dom 中删除一个元素,以使另一个 z 索引元素可点击
- c# - 如何在正确的位置实例化对象?