Skip to content

NoSuchMethodError #29

@kaldhu

Description

@kaldhu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions