Closed Endergame15 closed 6 years ago
Can you be more specific with your use case and the problem you're running into?
Closing due to inactivity, please re-open if you're still having issues, @Endergame15
I am having this issue same issue. This is the error message I see
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.
Hello, if we allow all stuff on patreon i became the NoSuchMethodError at this line: JSONAPIDocument userResponse = api.fetchUser();. Please help me.
~Endergame15