question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes while starting CameraFragment

See original GitHub issue

App crashes at first run.

2019-05-10 10:11:08.013 3579-3579/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.android.example.cameraxbasic, PID: 3579
    java.lang.ArithmeticException: divide by zero
        at androidx.camera.camera2.impl.SupportedSurfaceCombination.getAllPossibleSizeArrangements(SupportedSurfaceCombination.java:435)
        at androidx.camera.camera2.impl.SupportedSurfaceCombination.getSuggestedResolutions(SupportedSurfaceCombination.java:195)
        at androidx.camera.camera2.impl.Camera2DeviceSurfaceManager.getSuggestedResolutions(Camera2DeviceSurfaceManager.java:185)
        at androidx.camera.core.CameraX.calculateSuggestedResolutions(CameraX.java:449)
        at androidx.camera.core.CameraX.bindToLifecycle(CameraX.java:144)
        at com.android.example.cameraxbasic.fragments.CameraFragment.bindCameraUseCases(CameraFragment.kt:313)
        at com.android.example.cameraxbasic.fragments.CameraFragment.access$bindCameraUseCases(CameraFragment.kt:104)
        at com.android.example.cameraxbasic.fragments.CameraFragment$onViewCreated$1.run(CameraFragment.kt:241)
        at android.os.Handler.handleCallback(Handler.java:878)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:209)
        at android.app.ActivityThread.main(ActivityThread.java:7046)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:486)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
2019-05-10 10:11:32.185 4832-4832/com.android.example.cameraxbasic E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.android.example.cameraxbasic, PID: 4832
    java.lang.ArithmeticException: divide by zero
        at androidx.camera.camera2.impl.SupportedSurfaceCombination.getAllPossibleSizeArrangements(SupportedSurfaceCombination.java:435)
        at androidx.camera.camera2.impl.SupportedSurfaceCombination.getSuggestedResolutions(SupportedSurfaceCombination.java:195)
        at androidx.camera.camera2.impl.Camera2DeviceSurfaceManager.getSuggestedResolutions(Camera2DeviceSurfaceManager.java:185)
        at androidx.camera.core.CameraX.calculateSuggestedResolutions(CameraX.java:449)
        at androidx.camera.core.CameraX.bindToLifecycle(CameraX.java:144)
        at com.android.example.cameraxbasic.fragments.CameraFragment.bindCameraUseCases(CameraFragment.kt:313)
        at com.android.example.cameraxbasic.fragments.CameraFragment.access$bindCameraUseCases(CameraFragment.kt:104)
        at com.android.example.cameraxbasic.fragments.CameraFragment$onViewCreated$1.run(CameraFragment.kt:241)
        at android.os.Handler.handleCallback(Handler.java:878)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:209)
        at android.app.ActivityThread.main(ActivityThread.java:7046)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:486)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
owahltinezcommented, Jun 6, 2019

This issue has now been fixed, please upgrade to 1.0.0-alpha02 version of CameraX:

dependencies {
    ...
    def camerax_version = "1.0.0-alpha02"
    implementation "androidx.camera:camera-core:${camerax_version}"
}
0reactions
ChineseBoyLYcommented, May 23, 2019

me too

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes when running code from in fragment
Yes it crashes because findViewById wasn't called from the fragment_calendar layout before returning inflater therefore anything called after ...
Read more >
Why do my apps keep crashing on Android, How to fix it
To do this, go to Settings -> Apps and select the app that keeps crashing. Tap on the app's name and then tap...
Read more >
Why Do My Apps Keep Crashing on Android? - Avast
Apps on Android can crash because of low storage space, too many apps running simultaneously, a weak internet connection, or not having the ......
Read more >
What to Do If Apps Keep Crashing on an Android Device
1. Start the Settings app. · 2. Tap Apps & notifications. · 3. Find the crashing app in the list of apps. You...
Read more >
How to Fix Crashing Apps on an iPhone or Android?
You'll know it's worked when the start logo flashes up. Update App To The Last Version, The App Crash Fixer. Sometimes app-crashing is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found