React-native-camera error when compiling android

Insert the following lines in android/app/build.gradle

android {
  ...
  defaultConfig {
    ...
    missingDimensionStrategy 'react-native-camera', 'general' <-- insert this line
  }
}

Please insert the following line in android/app/build.gradle inside defaultConfig block either

missingDimensionStrategy 'react-native-camera', 'general'

or

missingDimensionStrategy 'react-native-camera', 'mlkit'

Add jitpack to android/build.gradle

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com" }
    }
}

Complete guide

Could not resolve project :react-native-camera. on Android