natario1/CameraView

Crashing when used with AGP 8.2

Closed this issue · 1 comments

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)

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.**