Question

I just tried to update my project from zxing core 2.3.0 to 3.0.0 and experience this charset problem. Not sure yet if this is a bug or if I have to provide the charsets now in some way - can anyone shed a light on it? Should I open a issue on github for this or can I provide the charsets in any way?

java.lang.ExceptionInInitializerError
E/AndroidRuntime( 4287):    at com.google.zxing.pdf417.encoder.PDF417.<init>(PDF417.java:531)
E/AndroidRuntime( 4287):    at com.google.zxing.pdf417.encoder.PDF417.<init>(PDF417.java:525)
E/AndroidRuntime( 4287):    at com.google.zxing.pdf417.PDF417Writer.encode(PDF417Writer.java:52)
E/AndroidRuntime( 4287):    at com.google.zxing.MultiFormatWriter.encode(MultiFormatWriter.java:94)
E/AndroidRuntime( 4287):    at com.google.zxing.MultiFormatWriter.encode(MultiFormatWriter.java:47)
E/AndroidRuntime( 4287):    at org.ligi.passandroid.helper.BarcodeHelper.getBitMatrix(BarcodeHelper.java:51)
E/AndroidRuntime( 4287):    at org.ligi.passandroid.helper.BarcodeHelper.generateBarCodeBitmap(BarcodeHelper.java:23)
E/AndroidRuntime( 4287):    at org.ligi.passandroid.model.Passbook.getBarcodeBitmap(Passbook.java:322)
E/AndroidRuntime( 4287):    at org.ligi.passandroid.ui.TicketViewActivity.onCreate(TicketViewActivity.java:86)
E/AndroidRuntime( 4287):    at android.app.Activity.performCreate(Activity.java:5008)
E/AndroidRuntime( 4287):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime( 4287):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime( 4287):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
E/AndroidRuntime( 4287):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
E/AndroidRuntime( 4287):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
E/AndroidRuntime( 4287):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4287):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4287):    at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 4287):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4287):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4287):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 4287):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 4287):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 4287): Caused by: java.nio.charset.UnsupportedCharsetException: Cp437
E/AndroidRuntime( 4287):    at java.nio.charset.Charset.forName(Charset.java:303)
E/AndroidRuntime( 4287):    at com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.<clinit>(PDF417HighLevelEncoder.java:128)
E/AndroidRuntime( 4287):    ... 23 more
Était-ce utile?

La solution

Yes it is an extended charset for Java. The name is right and PDF417 needs it by default. Android may not support it. What happens if you choose a different encoding? That is likely the best answer if you must encode this format on Android.

EDIT: This is mostly work-around-able. https://github.com/zxing/zxing/issues/105

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top