zxing-android-embedded: Crash : java.lang.ArithmeticException: divide by zero

Description of the problem:

Which library version are you using? 3.5.0.

Which phone/tablet are you using, and which Android version does it run? (e.g. Samsung Galaxy S5, Android 5.0)

Samsung - Android 7

Does the same happen on other devices or an emulator? No

Can you reproduce the issue in the sample project included with the library? If not, can you provide your own sample project or sample code that produces this error? No

In the case of an error do you have a stack trace or adb logs?

Fatal Exception: java.lang.ArithmeticException: divide by zero
       at com.journeyapps.barcodescanner.CameraPreview.calculateFrames(SourceFile:389)
       at com.journeyapps.barcodescanner.CameraPreview.previewSized(SourceFile:461)
       at com.journeyapps.barcodescanner.CameraPreview.access$300(SourceFile:59)
       at com.journeyapps.barcodescanner.CameraPreview$3.handleMessage(SourceFile:199)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6692)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 17 (2 by maintainers)

Most upvoted comments

Please let me know if is there any fix for this issue

I am also facing this issue. Any fix for this.

@rkistner can you please add a fix to 3.x version as well?

I’m asking cause our app needs to support android api 21 so we cannot upgrade to 4.x version

The fixes won’t be backported.

You can use the latest versions with Android API 14+, either by:

  1. Downgrading zxing:core - see https://github.com/journeyapps/zxing-android-embedded#older-sdk-versions
  2. OR by using AGP - see https://github.com/journeyapps/zxing-android-embedded/pull/612