ProGuard java.lang.NoSuchMethodException

余生颓废 提交于 2019-12-24 10:35:46

问题


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:


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.



来源:https://stackoverflow.com/questions/27687973/proguard-java-lang-nosuchmethodexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!