Hi guys, im developing a little app in android and works fine on my emulator, but when i try it on my phone, it gives this error:
java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets
at com.mb3364.http.RequestParams.<clinit>(RequestParams.java:18)
at com.mb3364.http.HttpClient.request(HttpClient.java:47)
at com.mb3364.http.HttpClient.get(HttpClient.java:151)
at com.mb3364.http.AsyncHttpClient.access$301(AsyncHttpClient.java:12)
at com.mb3364.http.AsyncHttpClient$4.run(AsyncHttpClient.java:86)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:838)
And this is the code that gives that error:
twitch.users().get(new UserResponseHandler() {
@Override
public void onFailure(int statusCode,
String statusMessage, String errorMessage) {
System.out.println("Fail 1: " + statusMessage + " - "
+ statusCode + " - " + errorMessage);
}
@Override
public void onFailure(Throwable e) {
System.out.println("Fail 2");
}
@Override
public void onSuccess(User arg0) {
logo = arg0.getLogo();
name = arg0.getDisplayName();
System.out.println("nombre: " + name);
numF = 1;
}
});
I read that maybe the problem is that “StandardCharsets” needs API level 19 to work, and mine is lower, is there any solutions i could use?
I find something, it sais that to solve it you have to substitute “StandardCharsets.UTF_8” to “Charset.forName(“UTF-8”)”.
Thank you!!