From d5aeb80bb916c9d41f7ec4f45f1b4af84a92c59b Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 5 Feb 2022 13:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9AAndroid=2011+=20mail?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E5=AF=BC=E8=87=B4crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ++++ app/src/main/java/com/idormy/sms/forwarder/MyApplication.java | 3 ++- .../java/com/idormy/sms/forwarder/sender/SenderMailMsg.java | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 40a5ac75..d91eb4ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -71,6 +71,8 @@ android { def abiCodes = ['universal': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'x86': 4, 'x86_64': 5] packagingOptions { resources { + pickFirst 'META-INF/LICENSE.md' + pickFirst 'META-INF/NOTICE.md' excludes += ['META-INF/DEPENDENCIES.txt', 'META-INF/LICENSE.txt', 'META-INF/NOTICE.txt', 'META-INF/NOTICE', 'META-INF/LICENSE', 'META-INF/DEPENDENCIES', 'META-INF/notice.txt', 'META-INF/license.txt', 'META-INF/dependencies.txt', 'META-INF/LGPL2.1'] } } @@ -159,6 +161,8 @@ dependencies { //EmailKit implementation 'com.github.mailhu:emailkit:4.2.2' + implementation 'com.sun.mail:android-mail:1.6.7' + implementation 'com.sun.mail:android-activation:1.6.7' //Lombok //noinspection AnnotationProcessorOnCompilePath diff --git a/app/src/main/java/com/idormy/sms/forwarder/MyApplication.java b/app/src/main/java/com/idormy/sms/forwarder/MyApplication.java index 91adb2e7..089913dd 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/MyApplication.java +++ b/app/src/main/java/com/idormy/sms/forwarder/MyApplication.java @@ -22,6 +22,7 @@ import com.idormy.sms.forwarder.utils.PermissionInterceptor; import com.idormy.sms.forwarder.utils.PhoneUtils; import com.idormy.sms.forwarder.utils.SettingUtil; import com.idormy.sms.forwarder.utils.SharedPreferencesHelper; +import com.smailnet.emailkit.EmailKit; import com.umeng.commonsdk.UMConfigure; import java.util.ArrayList; @@ -88,7 +89,7 @@ public class MyApplication extends Application { SendHistory.init(this); SettingUtil.init(this); - //EmailKit.initialize(this); + EmailKit.initialize(this); SharedPreferences sp = MyApplication.this.getSharedPreferences(Define.SP_CONFIG, Context.MODE_PRIVATE); showHelpTip = sp.getBoolean(Define.SP_CONFIG_SWITCH_HELP_TIP, true); diff --git a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderMailMsg.java b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderMailMsg.java index 0dbb048a..9266315f 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderMailMsg.java +++ b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderMailMsg.java @@ -3,7 +3,6 @@ package com.idormy.sms.forwarder.sender; import android.os.Handler; import android.util.Log; -import com.idormy.sms.forwarder.MyApplication; import com.idormy.sms.forwarder.utils.LogUtil; import com.smailnet.emailkit.Draft; import com.smailnet.emailkit.EmailKit; @@ -22,7 +21,7 @@ public class SenderMailMsg extends SenderBaseMsg { try { //初始化框架 - EmailKit.initialize(MyApplication.getContext()); + //EmailKit.initialize(MyApplication.getContext()); //配置发件人邮件服务器参数 EmailKit.Config config = new EmailKit.Config()