From 3007cd9430ee3c1d1e14b01dac8cc401ea3ca540 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 7 Jul 2021 13:18:38 +0200 Subject: [PATCH] fix: Add `@Keep` annotation to prevent minifier from deleting java funcs --- .../camera/frameprocessor/FrameProcessorRuntimeManager.kt | 3 +++ .../com/mrousavy/camera/frameprocessor/ImageProxyUtils.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorRuntimeManager.kt b/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorRuntimeManager.kt index f9fdba5..736f984 100644 --- a/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorRuntimeManager.kt +++ b/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorRuntimeManager.kt @@ -1,6 +1,7 @@ package com.mrousavy.camera.frameprocessor import android.util.Log +import androidx.annotation.Keep import com.facebook.jni.HybridData import com.facebook.proguard.annotations.DoNotStrip import com.facebook.react.bridge.ReactApplicationContext @@ -55,6 +56,8 @@ class FrameProcessorRuntimeManager(context: ReactApplicationContext) { mHybridData?.resetNative() } + @DoNotStrip + @Keep fun findCameraViewById(viewId: Int): CameraView { Log.d(TAG, "finding view $viewId...") val view = mContext?.get()?.currentActivity?.findViewById(viewId) diff --git a/android/src/main/java/com/mrousavy/camera/frameprocessor/ImageProxyUtils.java b/android/src/main/java/com/mrousavy/camera/frameprocessor/ImageProxyUtils.java index 6606c89..3553921 100644 --- a/android/src/main/java/com/mrousavy/camera/frameprocessor/ImageProxyUtils.java +++ b/android/src/main/java/com/mrousavy/camera/frameprocessor/ImageProxyUtils.java @@ -2,12 +2,17 @@ package com.mrousavy.camera.frameprocessor; import android.annotation.SuppressLint; import android.media.Image; + +import androidx.annotation.Keep; import androidx.camera.core.ImageProxy; import com.facebook.proguard.annotations.DoNotStrip; +@DoNotStrip +@Keep public class ImageProxyUtils { @SuppressLint("UnsafeOptInUsageError") @DoNotStrip + @Keep public static boolean isImageProxyValid(ImageProxy imageProxy) { try { Image image = imageProxy.getImage();