DEV Community

gie3d
gie3d

Posted on

Expo Camera set up in Bare workflow

Found a difficulty when I tried to eject an app with expo-camera from Expo Managed into Bare workflow. Our team managed to solve this problem and I blog it as a reference

From my experience, it's simple to use most of expo component in the Bare workflow until I come across expo-camera. I expected it to be managed by react-native-unimodules. However, thing wasn't that simple. This is the error I observed during gradle build:

ERROR: Failed to resolve: com.google.android:cameraview:1.0.0
Show in Project Structure dialog
Affected Modules: app
Enter fullscreen mode Exit fullscreen mode

This can be fixed by applying this into build.gradle

allprojects {
    repositories {
        ...your code
        maven {
            // expo-camera bundles a custom com.google.android:cameraview
            url "$rootDir/../node_modules/expo-camera/android/maven"
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

and you're good to go!

The hardest part is the above hasn't been stated in the component reference. But it's located deeply in its github repo here https://github.com/expo/expo/tree/sdk-39/packages/expo-camera

Top comments (0)