nio.Charsets error in Samsung devices with Android 4.3 and 4.2

Forum / MIFARE SDK / nio.Charsets error in Samsung devices with Android 4.3 and 4.2

  • 16. February 2016 at 10:15
    Hi,

    we have a problem writing Ndef content in a ultralight C card with Android 4.x devices (4.3 and 4.2), it always gives an error saying that nio.Charsets can not be found.

    Reading the data on the card is ok and we have managed to make it work modifying the source code for classes NdefMessage and NdefRecord replacing calls to Charsets.UTF_8 by charset.forName("UTF-8"), but we need a better solution for this problem.

    Regards
    + 0  |  - 0

    Re: nio.Charsets error in Samsung devices with Android 4.3 and 4.2

    16. February 2016 at 12:11
    Hi,

    Is it possible to give us more information?
    Which kind of NDEF message you want to write? Do you have some lines of Logcat output of the stack trace?

    Thank you,
    The MIFARE Team
    + 0  |  - 0

    Re: nio.Charsets error in Samsung devices with Android 4.3 and 4.2

    16. February 2016 at 12:58
    Hi,

    I get the error on this line
    NdefRecord ndefRecord = NdefRecord.createExternal(packageName,"String", valueByteArray);

    java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets
    at com.nxp.nfclib.ndef.NdefRecord.createExternal(:506)
    at com.teatrobarakaldo.activities.WriterSingleCardActivity$3.onUltraLightCCardDetected(WriterSingleCardActivity.java:180)
    at com.nxp.nfcliblite.NxpNfcLibLite.ˊ(:696)
    at com.nxp.nfcliblite.NxpNfcLibLite.filterIntent(:369)
    at com.teatrobarakaldo.activities.WriterSingleCardActivity.onNewIntent(WriterSingleCardActivity.java:225)
    at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1178)
    at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2418)
    at android.app.ActivityThread.performNewIntents(ActivityThread.java:2431)
    at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2440)
    at android.app.ActivityThread.access$1500(ActivityThread.java:159)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1387)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:176)
    at android.app.ActivityThread.main(ActivityThread.java:5419)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
    at dalvik.system.NativeStart.main(Native Method)


    Regards,
    + 0  |  - 0

    Re: nio.Charsets error in Samsung devices with Android 4.3 and 4.2

    16. February 2016 at 13:20
    I guess it's because java.nio.charset.StandardCharsets was not present in Java 6.
    + 0  |  - 0

    Re: nio.Charsets error in Samsung devices with Android 4.3 and 4.2

    18. February 2016 at 8:34
    Hi,

    The development team respond that this fix or change due to android version upgrade has already been planned and shall be part of next release (expected in couple of weeks).

    I hope it helps,
    The MIFARE Team

    + 0  |  - 0

    Re: nio.Charsets error in Samsung devices with Android 4.3 and 4.2

    18. February 2016 at 8:38
    Nice, thanks for your help :)

    Regards
    + 0  |  - 0
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.