React Native Camera Issues on Android

Okay, yours truly has been away working in a startup and has not had the time to write much of anything.

However, the problem that I am about to write about pissed me off enough that I had to blog about the solution.

I had to integrate a camera into a react native app and I chose to use React Native Camera since apparently it was the first on my Google search, seems to be updated recently and the articles saying how awesome it was sold me. It would have been a great experience, if it worked out of the box, which I assure you it did not. Wasted quite a few hours with it.

I ran through the install steps in the guide and I kept on getting this rather infuriating message:

error message

With dogged determination, I tried everything I could think of for many hours. In the end, I discovered that the react-native link react-native-camera command which, to the uninitiated, is meant to linkup native modules with the your React Native app, did not update all the necessary gradle build files. Namely the one located at ./android/app/build.gradle. The file diff showing my manual entry should highlight the problem well:

manual gradle update

With this, the camera module now compiles with the app and life goes on.

Hopefully me writing about this jiggery pokery to solve this has saved you some pain.