androidreact-nativekotlinexpoexpo-camera

Expo-camera: compileDebugKotlin FAILED


I had this error when trying to build expo app on Android with expo-camera@14.0.6. It works fine on IOS.

error

> Task :expo-camera:compileDebugKotlin
e: file:///.../app/node_modules/expo-camera/android/src/main/java/expo/modules/camera/ExpoCameraView.kt:279:25 Unresolved reference: raw
e: file:///.../app/node_modules/expo-camera/android/src/main/java/expo/modules/camera/next/ExpoCameraView.kt:424:25 Unresolved reference: raw
e: file:///.../app/node_modules/expo-camera/android/src/main/java/expo/modules/camera/next/analyzers/BarcodeAnalyzer.kt:54:81 Type mismatch: inferred type is String? but (Mutable)List<Int!>! was expected
e: file:///.../app/node_modules/expo-camera/android/src/main/java/expo/modules/camera/next/analyzers/BarcodeAnalyzer.kt:54:86 Type mismatch: inferred type is MutableList<Int> but Int was expected
e: file:///.../app/node_modules/expo-camera/android/src/main/java/expo/modules/camera/next/analyzers/BarcodeAnalyzer.kt:54:113 Too many arguments for public constructor BarCodeScannerResult(p0: Int, p1: String!, p2: (Mutable)List<Int!>!, p3: Int, p4: Int) defined in expo.modules.interfaces.barcodescanner.BarCodeScannerResult

> Task :expo-camera:compileDebugKotlin FAILED

Some info: package.json

    "expo": "^50.0.6",
    "expo-camera": "14.0.6",
    "react-native": "0.73.4",

app.json

{ expo: {
"plugins": [ 
      [ "expo-camera", 
        { 
          "cameraPermission": "Allow $(PRODUCT_NAME) to access your camera", 
          "microphonePermission": "Allow $(PRODUCT_NAME) to access your microphone", 
          "recordAudioAndroid": true 
        } 
      ]
    ]
}
}

I tried multiple solutions found online but none of it worked. What I did:


Solution

  • Solved this by upgrading expo version from 50.0.6 to 50.0.11.

    The problem was that the expo-modules-core dependency in version 50.0.6 doesn't include the changes that are need for expo-camera/next