react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

🐛 This declaration is opt-in and its usage should be marked with

Open AmirHMousavi opened this issue 2 years ago • 0 comments

What were you trying to do?

Building the app for Android with ./gradlew build command

Environment data:

 "react": "17.0.2",
 "react-native": "0.68.2",
 
 # build.gradle
 buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31

        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }
    }
  }
  
  distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

#  app/build.gradle
 android{
    defaultConfig {
          multiDexEnabled true
          
# machine
MacbookPro , Apple M1 Pro
macOS Monterey 12.4

Reproduceable Code

No response

What happened instead?

Task :react-native-vision-camera:lintDebug FAILED

Relevant log output

> Task :react-native-vision-camera:lintDebug FAILED
Lint found 3 errors, 0 warnings. First failure:

/<project-path>/node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/CameraView.kt:431: Error: This declaration is opt-in and its usage should be marked with

The full lint text report is located at:
  /<project-path>/node_modules/react-native-vision-camera/android/build/intermediates/lint_intermediate_text_report/debug/lint-results-debug.txt
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions


the lint-result.debug.txt content

/<project-path>/node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/CameraView.kt:431: Error: This declaration is opt-in and its usage should be marked with
'@androidx.camera.camera2.interop.ExperimentalCamera2Interop' or '@OptIn(markerClass = androidx.camera.camera2.interop.ExperimentalCamera2Interop.class)' [UnsafeOptInUsageError from jetified-annotation-experimental-1.1.0]
            Camera2Interop.Extender(previewBuilder)
                           ~~~~~~~~
/<project-path>/node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/CameraView.kt:432: Error: This declaration is opt-in and its usage should be marked with
'@androidx.camera.camera2.interop.ExperimentalCamera2Interop' or '@OptIn(markerClass = androidx.camera.camera2.interop.ExperimentalCamera2Interop.class)' [UnsafeOptInUsageError from jetified-annotation-experimental-1.1.0]
              .setCaptureRequestOption(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, Range(fps, fps))
               ~~~~~~~~~~~~~~~~~~~~~~~
/<project-path>/node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/CameraView.kt:433: Error: This declaration is opt-in and its usage should be marked with
'@androidx.camera.camera2.interop.ExperimentalCamera2Interop' or '@OptIn(markerClass = androidx.camera.camera2.interop.ExperimentalCamera2Interop.class)' [UnsafeOptInUsageError from jetified-annotation-experimental-1.1.0]
              .setCaptureRequestOption(CaptureRequest.SENSOR_FRAME_DURATION, frameDuration)
               ~~~~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "UnsafeOptInUsageError":
   This API has been flagged as opt-in with error-level severity.

   Any declaration annotated with this marker is considered part of an
   unstable or
   otherwise non-standard API surface and its call sites should accept the
   opt-in
   aspect of it either by using @OptIn or by being annotated with that marker
   themselves, effectively causing further propagation of the opt-in aspect.

   Vendor: Android Open Source Project (jetified-annotation-experimental-1.1.0)
   Identifier: jetified-annotation-experimental-1.1.0
   Feedback: https://issuetracker.google.com/issues/new?component=192731

3 errors, 0 warnings

Device

Android

VisionCamera Version

2.13.5

Additional information

AmirHMousavi avatar Jun 21 '22 14:06 AmirHMousavi