ProGuard java.lang.NoSuchMethodException

2019-08-13 04:01发布

After turning on the ProGuard I can't connect to IMAPSSLStore. Here's a bit from logcat window:

A0 OK Thats all she wrote! i1mb111841581wil
IMAP DEBUG: AUTH: XOAUTH
IMAP DEBUG: AUTH: XOAUTH2
IMAP DEBUG: AUTH: PLAIN
IMAP DEBUG: AUTH: PLAIN-CLIENTTOKEN
DEBUG: protocolConnect login, host=imap.gmail.com, user=user***@gmail.com, password=
IMAP DEBUG: Can't load SASL authenticator: java.lang.NoSuchMethodException: [class com.b.b.b.a.i, class java.lang.String, class java.util.Properties, boolean, class java.io.PrintStream, class java.lang.String]
A1 AUTHENTICATE PLAIN +
A1 NO [ALERT] Invalid credentials (Failure)
a.b.b: [ALERT] Invalid credentials (Failure)

My Provider class:

 public static final class OAuth2Provider extends java.security.Provider {
    private static final long serialVersionUID = 1L;

    public OAuth2Provider() {
        super("Google OAuth2 Provider", 1.0,
                "Provides the XOAUTH2 SASL Mechanism");
        try {
           put("SaslClientFactory.XOAUTH2", "com.company.app.OAuth2SaslClientFactory");
        }
        catch (Exception e)
        {
           System.out.println("OAUTH2Provider error.");
        }


    }
}

In proguard-project.txt I tried (HelperClass is my class where I connect to the store):

-keep class com.company.app.HelperClass.**
-keep class javax.security.sasl.** { *; }
-keep class com.sun.mail.imap.IMAPSSLStore.**
-keep class java.security.** { *; }

Nothing works....

Please help :)

p.s. sorry, don't know how to format stacktrace better

1条回答
甜甜的少女心
2楼-- · 2019-08-13 04:46

OAuth2SaslClientFactory is a class I got from here: https://code.google.com/p/google-mail-oauth2-tools/source/browse/trunk/java/com/google/code/samples/oauth2/OAuth2SaslClientFactory.java?r=3

I had to include the ProGuard line

-keep class com.company.app.OAuth2SaslClientFactory

among others.

查看更多
登录 后发表回答