Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError #29

Open
kaldhu opened this issue Nov 25, 2018 · 1 comment
Open

NoSuchMethodError #29

kaldhu opened this issue Nov 25, 2018 · 1 comment

Comments

@kaldhu
Copy link

kaldhu commented Nov 25, 2018

This has been reported before but it was closed, I did post on that one put it seems to have not been noticed so i am opening a new issue

java.lang.NoSuchMethodError: No static method encPath(Ljava/lang/String;Ljava/nio/charset/Charset;)Ljava/lang/String; in class Lorg/apache/http/client/utils/URLEncodedUtils; or its super classes (declaration of 'org.apache.http.client.utils.URLEncodedUtils' appears in /system/framework/org.apache.http.legacy.boot.jar)
        at org.apache.http.client.utils.URIBuilder.encodePath(URIBuilder.java:172)
        at org.apache.http.client.utils.URIBuilder.buildString(URIBuilder.java:135)
        at org.apache.http.client.utils.URIBuilder.toString(URIBuilder.java:343)
        at com.patreon.PatreonAPI.fetchUser(PatreonAPI.java:95)
        at com.patreon.PatreonAPI.fetchUser(PatreonAPI.java:74)
        at com.******.Actvities.PatreonActivity$1.run(PatreonActivity.java:43)
        at java.lang.Thread.run(Thread.java:764)

This is the calling code, which apart from the threading around it, is the same code that is within the wiki


        Thread thread = new Thread(new Runnable(){
            public void run() {
                try {
                    PatreonOAuth oauthClient = new PatreonOAuth(clientId, clientSecret, redirectUri);
                    PatreonOAuth.TokensResponse tokens = oauthClient.getTokens(code);
                    String accessToken = tokens.getAccessToken();

                    PatreonAPI apiClient = new PatreonAPI(accessToken);
                    JSONAPIDocument<User> userResponse = apiClient.fetchUser();
                    User user = userResponse.get();
                    List<Pledge> pledges = user.getPledges();
                    if (pledges != null && pledges.size() > 0) {
                        Pledge pledge = pledges.get(0);
                    }
                } catch (Exception ex){
                }
            }
        });

Looking into the code the issue seems to be at the following function within .gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.2.3\3328e73c4c97cc62e1077ff754308c98ab1564a\httpclient-4.2.3-sources.jar!\org\apache\http\client\utils\URIBuilder.java:

private String encodePath(final String path) {
      return URLEncodedUtils.encPath(path, Consts.UTF_8);
  }

I have managed to fix the issue myself by creating a version of the PatreonAPI class and replacing the use of URIBuilder with Uri.Builder.

If you have any suggestions which allow me to use the PatreonAPI class from this package instead please let me know as rewriting entire classes is not my aim.

But I am having issues creating my APK due to conflicts with Apache that is used within this plugin

@nperickson
Copy link

Thank you @kaldhu for reporting this. We have added this to our backlog and hope to have a fix in place as soon as we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants