Error with API Wrapper in Android

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>(
at com.mb3364.http.HttpClient.request(
at com.mb3364.http.HttpClient.get(
at com.mb3364.http.AsyncHttpClient.access$301(
at com.mb3364.http.AsyncHttpClient$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

And this is the code that gives that error:

twitch.users().get(new UserResponseHandler() {
      public void onFailure(int statusCode,
      String statusMessage, String errorMessage) {
             System.out.println("Fail 1: " + statusMessage + " - "
            + statusCode + " - " + errorMessage);

      public void onFailure(Throwable e) {
             System.out.println("Fail 2");

      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!!

Hello peter6006!
Seems like the StandardCharsets class is not compiled with your android application! This is more a Android Application question then a Twitch Api question. Anyways, Check out this stackoverflow thread for a little more information on how to fix the problem.
Hope this helps, Avery!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.