fix: Add @Keep annotation to prevent minifier from deleting java funcs

This commit is contained in:
Marc Rousavy 2021-07-07 13:18:38 +02:00
parent 7a5e879b92
commit 3007cd9430
2 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package com.mrousavy.camera.frameprocessor package com.mrousavy.camera.frameprocessor
import android.util.Log import android.util.Log
import androidx.annotation.Keep
import com.facebook.jni.HybridData import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactApplicationContext
@ -55,6 +56,8 @@ class FrameProcessorRuntimeManager(context: ReactApplicationContext) {
mHybridData?.resetNative() mHybridData?.resetNative()
} }
@DoNotStrip
@Keep
fun findCameraViewById(viewId: Int): CameraView { fun findCameraViewById(viewId: Int): CameraView {
Log.d(TAG, "finding view $viewId...") Log.d(TAG, "finding view $viewId...")
val view = mContext?.get()?.currentActivity?.findViewById<CameraView>(viewId) val view = mContext?.get()?.currentActivity?.findViewById<CameraView>(viewId)

View File

@ -2,12 +2,17 @@ package com.mrousavy.camera.frameprocessor;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.media.Image; import android.media.Image;
import androidx.annotation.Keep;
import androidx.camera.core.ImageProxy; import androidx.camera.core.ImageProxy;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip
@Keep
public class ImageProxyUtils { public class ImageProxyUtils {
@SuppressLint("UnsafeOptInUsageError") @SuppressLint("UnsafeOptInUsageError")
@DoNotStrip @DoNotStrip
@Keep
public static boolean isImageProxyValid(ImageProxy imageProxy) { public static boolean isImageProxyValid(ImageProxy imageProxy) {
try { try {
Image image = imageProxy.getImage(); Image image = imageProxy.getImage();