I'm trying to send an e-mail like in this post: Sending Email in Android using JavaMail API without using the default/built-in app
我正在尝试发送这样的电子邮件:使用JavaMail API在Android中发送电子邮件,而不使用默认/内置应用程序
And adding in my build.gradle and app file this lines: https://javaee.github.io/javamail/Android
并在我的build.gradle和app文件中添加以下行:https://javaee.github.io/javamail/Android
Error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/sun/activation/registries/LineTokenizer;
错误:任务':app:transformClassesWithDexForDebug'的执行失败。 > com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.dex.DexException:多个dex文件定义Lcom / sun / activation /注册/ LineTokenizer;
But with the following app file I have a execution failed and don't know why.
但是使用以下app文件我执行失败并且不知道为什么。
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.github.ocaparrostortosa.MyApplication"
minSdkVersion 21
targetSdkVersion 25
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' // picks the JavaMail license file
}
}
dependencies {
compile 'com.sun.mail:android-mail:1.5.5'
compile 'com.sun.mail:android-activation:1.5.5'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And this one is my Project gradle:
这个是我的项目gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.java.net/content/groups/public/"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Can someone help me please? I'm close to finish the project :D
有谁可以帮助我吗?我即将完成项目:D
P.D: Sorry for my English and for the presentation, I'm new in *.
P.D:对不起我的英语和演示文稿,我是*的新手。
1 个解决方案
#1
2
this error is quite tricky. i also had a hard time on this. I solve my problem somehow by adding this multiDexEnabled true
on my gradle build.config
这个错误非常棘手。我也很难过。我通过在gradle build.config上添加这个multiDexEnabled,以某种方式解决了我的问题
android {
defaultConfig {
minSdkVersion 14 x
targetSdkVersion 23
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
Take note, this solution is case to case basis. One scenario is - my app was very large that it exceeds 64MB limit. If this does not work, check your dependencies.
请注意,此解决方案是个案基础。一种情况是 - 我的应用程序非常大,超过了64MB的限制。如果这不起作用,请检查您的依赖项。
Other scenario was caused by Google Maps API dependencies that the version needs to be inline with the APP target SDK.
其他情况是由Google Maps API依赖项引起的,该版本需要与APP目标SDK内联。
#1
2
this error is quite tricky. i also had a hard time on this. I solve my problem somehow by adding this multiDexEnabled true
on my gradle build.config
这个错误非常棘手。我也很难过。我通过在gradle build.config上添加这个multiDexEnabled,以某种方式解决了我的问题
android {
defaultConfig {
minSdkVersion 14 x
targetSdkVersion 23
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
Take note, this solution is case to case basis. One scenario is - my app was very large that it exceeds 64MB limit. If this does not work, check your dependencies.
请注意,此解决方案是个案基础。一种情况是 - 我的应用程序非常大,超过了64MB的限制。如果这不起作用,请检查您的依赖项。
Other scenario was caused by Google Maps API dependencies that the version needs to be inline with the APP target SDK.
其他情况是由Google Maps API依赖项引起的,该版本需要与APP目标SDK内联。