1

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

tommybee
  • 2,409
  • 1
  • 20
  • 23
okkko
  • 1,010
  • 1
  • 13
  • 22
  • You can try upgrading to [JavaMail 1.5.2](https://java.net/projects/javamail/pages/Home), which includes [built-in OAuth2 support](https://java.net/projects/javamail/pages/OAuth2), to see if that helps. – Bill Shannon Dec 31 '14 at 21:04
  • Thanks, but the answer was another ProGuard line (below). – okkko Jan 02 '15 at 07:44

1 Answers1

0

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.

okkko
  • 1,010
  • 1
  • 13
  • 22