修复:Android 11+ mail报错导致crash

This commit is contained in:
pppscn 2022-02-05 13:45:07 +08:00
parent e9bb3aa627
commit d5aeb80bb9
3 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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);

View File

@ -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()