natario1 / CameraView

📸 A well documented, high-level Android interface that makes capturing pictures and videos easy, addressing all of the common issues and needs. Real-time filters, gestures, watermarks, frame processing, RAW, output of any size.
https://natario1.github.io/CameraView
Other
4.89k stars 922 forks source link

Crashing when used with AGP 8.2 #1271

Closed akshay-incred closed 4 months ago

akshay-incred commented 4 months ago

Is this because of R8 shrinker?

I read that R8 shrinker is more strict and removes default constructors

Logs

Fatal Exception: java.lang.RuntimeException: Filters should have a public no-arguments constructor.
       at com.otaliastudios.cameraview.filter.BaseFilter.onCopy(BaseFilter.java:204)
       at com.otaliastudios.cameraview.filter.BaseFilter.copy(BaseFilter.java:184)
       at com.otaliastudios.cameraview.filter.BaseFilter.copy(BaseFilter.java:41)
       at com.otaliastudios.cameraview.picture.SnapshotGlPictureRecorder.onRendererFilterChanged(SnapshotGlPictureRecorder.java:122)
       at com.otaliastudios.cameraview.picture.SnapshotGlPictureRecorder$1.onRendererFilterChanged(SnapshotGlPictureRecorder.java:90)
       at com.otaliastudios.cameraview.preview.GlCameraPreview$2.run(GlCameraPreview.java:303)
       at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1510)
       at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)
akshay-incred commented 4 months ago

For anybody facing this issue, add this proguard rules for R8 to keep classes and not to remove default no-arg constructors.

-keep class com.otaliastudios.cameraview.** { *; }
-dontwarn com.otaliastudios.cameraview.**