[CameraX] App crashes api < 21
See original GitHub issue- Android version 4.4.4, API 19
- dependencies: androidx.camera:camera-core:1.0.0-alpha06 androidx.camera:camera-camera2:1.0.0-alpha06
Problem I’m trying to use this library only for API > 21, but i also can’t run my application for API < 21 . I want to use this library like this:
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
useOldCamera();
} else {
useCameraX();
}
When i run my application, i get crash with this exception:
E/UncaughtException: java.lang.NoClassDefFoundError: android.util.Size
I’m trying to use this method, but it’s not help: stackoverflow
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top Results From Across the Web
android - While trying to implement CameraX, the app crashes
When I try to run it, the app crashes And AndroidStudio gives this error in logcat: https://i2.paste.pics/c77714ec26373276884c6d490f3bbe40.
Read more >Android application with cameraX library crash on start for API ...
I don't used any androidx.camera.core.CameraX function in API <21 ,but application still crash on start. Beasuse CameraX is initialized in app startup through...
Read more >CameraX API causes emulator to crash : r/androiddev - Reddit
If I set the camera to Emulated the app crashes with the divide by zero error. If I set the camera to VirtualScene...
Read more >CameraX | Android Developers
CodecException , especially on API 21-22 devices. ... However, this fix only prevents app from crashing, but doesn't resolve the cause of the ......
Read more >Issues with CameraX video library - Google Groups
I recently tried replacing the old video capture api with the new one and ... and my app just crashes when it manually...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@owahltinez Here another vote, I want to use CameraX where possible, but write the code for legacy Camera myself, with a conditional SDK_INT check. Now just adding the implementations makes the app crash. I need to support 4.1+, so I really don’t understand why it cannot be used conditionally.
@owahltinez But before I could write an if statement stating
if < api 21 use the deprecated camera
so I could still build for Android 4.x. That is not possible anymore.