android: minify 为真时不发送邮件

android: mails not sent when minify is true

正在尝试使用 javax.mail 包。当 minify 为 false 时,发送邮件。当 minify 为真时,不发送邮件。

这是AsyncTask doinbackground。当 minify 为真时,异常消息为“smtp”。

2021-03-31 14:52:35.196 26564-26652/? W: javax.mail.NoSuchProviderException: smtp
2021-03-31 14:52:35.196 26564-26652/? W:     at     javax.mail.Session.getService(Unknown Source:138)
2021-03-31 14:52:35.196 26564-26652/? W:     at     javax.mail.Session.getTransport(Unknown Source:10)
2021-03-31 14:52:35.196 26564-26652/? W:     at     javax.mail.Session.getTransport(Unknown Source:8)
2021-03-31 14:52:35.196 26564-26652/? W:     at     javax.mail.Session.getTransport(Unknown Source:12)
2021-03-31 14:52:35.196 26564-26652/? W:     at     javax.mail.Session.getTransport(Unknown Source:14)
2021-03-31 14:52:35.196 26564-26652/? W:     at     javax.mail.Transport.send0(Unknown Source:61)
2021-03-31 14:52:35.196 26564-26652/? W:     at javax.mail.Transport.send(Unknown Source:7)
2021-03-31 14:52:35.196 26564-26652/? W:     at     com.maor.cohen.utils.EmailUtils$SendMailTask.doInBackground(Unknown     Source:3)
2021-03-31 14:52:35.196 26564-26652/? W:     at     com.maor.cohen.utils.EmailUtils$SendMailTask.doInBackground(Unknown     Source:2)
2021-03-31 14:52:35.196 26564-26652/? W:     at android.os.AsyncTask.call(AsyncTask.java:378)
2021-03-31 14:52:35.196 26564-26652/? W:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2021-03-31 14:52:35.196 26564-26652/? W:     at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:289)
2021-03-31 14:52:35.196 26564-26652/? W:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2021-03-31 14:52:35.196 26564-26652/? W:     at     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2021-03-31 14:52:35.196 26564-26652/? W:     at java.lang.Thread.run(Thread.java:919)

asynctask doInBackground:

protected Void doInBackground(javax.mail.Message... messages) {
        try {
            Transport.send(messages[0]);
        } catch (MessagingException e) {
            Log.d("log_tag", "excpetion sending mail: " + e.getLocalizedMessage());
            e.printStackTrace();
        }
        return null;
    }

我添加了混淆器:

-keep class javax.** {*;}
-keep class javax.* {*;}
-keep class javax.mail.* {*;}

还没有发送邮件成功

知道如何解决这个问题吗? minify 必须是真的,应该在那里添加更多的东西。

Javamail 规则

-keep class javax.** {*;}
-keep class com.sun.** {*;}
-keep class myjava.** {*;}
-keep class org.apache.harmony.** {*;}
-keep public class MailClient {*;}
-dontwarn com.sun.mail.**
-dontwarn java.awt.**
-dontwarn java.beans.Beans
-dontwarn javax.security.**